Scala, Java, Unix, MacOS tutorials (page 1)

Lately I’ve been having a stray thought while editing Functional Programming, Simplified, 2nd Edition: Could Functional Programming be called Algebraic Programming?

Yes, FP is about pure functions, HOFs, and functions as values, but it’s also about domain modeling (ADTs), immutable variables (algebraic) and immutable data, errors as values, and EOP (expressions as equations).

Functional programmers also use the term “blueprint” a lot, so that’s another possible name.

To be clear, I’m not calling for a name change or anything like that, just observing that Algebraic Programming may be a more accurate name.

Since I’ve written two functional programming books, I thought it might help to provide a comparison of them. The short story is that both books have “limited technical jargon,” and as shown, The Little FP Book essentially has one purpose, which is to help Java/Kotlin/OOP developers learn functional programming as fast as possible, using a technique that I “discovered” over the last few years. Conversely, The Big FP Book covers many topics in great detail.

Here are links to the two books:

Functional programming books, comparison

February, 2023 Update: Learn Functional Programming Without Fear is one of my best-selling books on Gumroad.com (see the link below).

November, 2022: My new book, Learn Functional Programming Without Fear, is currently an Amazon Java and functional programming #1 new release. The book is now available in three formats:

PDF Format
$10 (USD) on Gumroad.com

Learn Functional Programming Without Fear (PDF Version)

Paperback
$20 on Amazon

Learn Functional Programming Without Fear (Paperback)

Kindle
$10 on Amazon

Learn Functional Programming Without Fear (Kindle Edition)

Some of the books on the right side of this image are amazing, and I would never discourage anyone from reading the great ones.

But if you’re an object-oriented programming (OOP) developer who wants to start understanding functional programming (FP) over a weekend or a few nights of reading, that’s the goal of the new little book on the left: Learn Functional Programming Without Fear. It takes you from Java/OOP to functional programming in the simplest possible step-by-step learning process.

FP for Java/Kotlin/OOP developers

I taught Java and OOP for many years, and have used other OOP languages like Kotlin, Python, and Flutter/Dart, so I understand both OOP and FP, and I think that helped to make this a simple book for learning FP.

I also wrote the FP book in the middle — Functional Programming, Simplified — and it’s about three times larger than the little book on the left. I based it on most of the FP books on the right, and it goes into many details that the book on the left doesn’t go into. It’s big, but it’s still easier than reading all the books on the right.

For OOP developers: The smallest, simplest functional programming book

When I was writing my new book on functional programming — Learn Functional Programming Without Fear — a few alternate titles for the book were:

  • The Fastest Way to Learn Functional Programming
  • Learn Functional Programming the Fast Way
  • From Object-Oriented Programming to Functional Programming
  • Helping Object-Oriented Programmers Learn Functional Programming
  • Functional Programming for Objected-Oriented Programmers

That’s because I found out — almost by accident — that the fastest way for object-oriented programming (OOP) developers to learn functional programming (FP) goes like this:

As a brief note today, I just released the first version of a new, free booklet that I’ve titled Learning Recursion.

Learning Recursion: A free booklet by Alvin Alexander

I am without form, without limit
Beyond space, beyond time
I am in everything, everything is in me
I am the bliss of the universe
Everywhere am I.

~ Ram Kir

A friend of mine was a devout yoga practitioner, and even studied under B.K.S. Iyengar. Right before she passed away, she began to cry tears of joy, and said, “All is one, all is one.”

Last week I started a This week in Scala page, and I’m going to see if I can do another one this week. Without further ado:

I’m currently writing my new book, Functional Programming, Simplified (Updated for Scala 3) directly in LaTeX, and this is my “LaTeX cheatsheet” that I keep open all the time so I can copy and paste the LaTeX stuff I need while I write.

Note that I don’t use any LaTeX formula stuff, so most of this is pretty basic LaTeX stuff, though there are a few custom commands/functions that probably won’t make sense to anyone unless I share some more details.

Here’s my current LaTeX cheatsheet:

My book, Functional Programming, Simplified — 4.5-star rated on Amazon, their 6th-best selling book on functional programming, and 5-star rated on Gumroad.com — is currently on sale in three formats (prices shown in USD):

PDF Format
$15 on Gumroad.com

PDF version of Functional Programming, Simplified

Paperback Book
Now $29.99 on Amazon

Print version of Functional Programming, Simplified

Kindle eBook
$14.99 on Amazon

Kindle version of Functional Programming, Simplified

I don’t know if I’ll keep this going or not, but I was looking for a way to monitor “What’s new in Scala,” so I thought I’d create a “This week in Scala” page. Here’s what’s new the week of January 15-21, 2023:

On the personal front:

As I note in How to use fold on a Scala Option, if you’re using Scala and need to create a None of a specific data type, either of these two approaches will solve the problem:

val none = Option.empty[Int]    // Option[Int]
val none: Option[Int] = None    // Option[Int]

Both of those approaches create the None with the type Option[Int], as shown in the Scala REPL:

scala> val none = Option.empty[Int]
val none: Option[Int] = None

scala> val none: Option[Int] = None
val none: Option[Int] = None

As a “note to self,” I like some of Shinzen Young’s sayings/analogies/metaphors in the first core lessons of the Brightmind app. The ones that come to mind are:

  • Try to listen to your mental talk in your head just like it’s a sound in nature, like listening to a bird. In this way, “you” can observe the thoughts in your head as the fly by, without getting attached to them.
  • In regards to your awareness, you can think of it in two different ways: (a) aiming your attention at a spot/area, or (b) hugging a friend.

For more details, check out the Brightmind app.

In December, 2022, in Winchester, Kentucky, the Clark County Public Library Board of Trustees took up the matter to potentially ban a book in the library they oversee. The book is an award-winning LGBTQ+ memoir that was already located in the Adult section of the library, but that wasn’t enough for the “conservative” trustees. While the library has many other sexually-explicit books (think Fifty Shades of Grey), the trustees singled out this one book, eventually voting that this award-winning book “is restricted to individuals over 18 unless a parent or guardian gives written consent.

I was going to share my opinion on censorship when I saw the quote in the image I shared (from this article): “Censorship is like a forest fire. It begins with a single ember, and if it is not extinguished at the outset, it becomes a raging conflagration that consumes everything in its path.”

Book banning in Winchester, Kentucky

I’m currently updating my best-selling book, Functional Programming, Simplified, to cover Scala 3 and other technologies like ZIO and Cats EFfect, and when that’s done, this will be the landing page for that book.

Until then, you can find the PDF for the new book that I’m creating here:

And you can find the Scala 2 version of the book here:

I’ll update this page as I have more information.

These are my abbreviated notes (Cliffsnotes) from watching the talk, What Functional Programming Can Learn From Object-Oriented Programming, by John De Goes. As a warning, the notes are incomplete, and just a reminder to me of some of the best and most important parts of the talk.

Relatively early on he notes that there are multiple ways to do Scala, but only one way to write Go code. This is both a pro and a con.

How about a simple functional programming book written with this style:

No monads.
No monoids.
No functors.
No category theory.
Just some Java & Scala code.

Robert Martin’s tweet about writing a new simple functional programming book (in Clojure) was shared with me here, and I like his initial wording on not worrying about monads, monoids, functors, and category theory. (I believe it was Eric Torreborre who shared a similar sentiment some time prior to this, that functional programming should be taught separate from category theory.)

I said almost the exact same thing five years ago in the beginning of my book, Functional Programming, Simplified, and then in Learn Functional Programming Without Fear I show how to start with Java/OOP code and slowly transition to a functional programming style with Scala/FP examples. Both books focus on simple, pragmatic functional programming source code examples, without getting lost in FP theory.

No monads. No monoids. No category theory. Just FP code.

Last night — December 18, 2022 — I started the process of updating my best-selling book, Functional Programming, Simplified. With this update the book is being updated to cover Scala 3, ZIO, and Cats Effect — none of which existed when I wrote the first edition of the book!

I’ll write more about this over time, but for now, click this link to learn more about Functional Programming, Simplified (Updated for Scala 3).

Functional Programming, Simplified: Updated for Scala 3!

As you might guess from looking at this collection of book covers, I LOVE writing about things like Scala and functional programming, but it pays about 1/10th of what programming does. To try to make it affordable to stay in the writing business, I’ve created this Patreon page. Any support is greatly appreciated 🙏 and will help keep me in the writing business.

Patreon page to support Alvin Alexander’s writing

I like what John De Goes shares in this talk about how to combine the best of FP & OOP. The “best of” portion of the talk starts about 36 minutes into the talk, which is where that link starts.

FWIW, I share almost all of the same information in my book, Functional Programming, Simplified, though I will admit that I probably don’t articulate it quite as well as his speech. (That being said, I wrote the book over five years ago, and it also includes some decent examples of domain modeling and code organization with Scala, FP, and OOP.)

Combining the best of FP and OOP with Scala