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

Sometimes people write to tell me that they like my writing style, that I’m good at explaining things. Other people write and say that if they wrote a book, they would have written it just like mine.

The truth is, when I first started working with Scala I fell in love with the language, so wanting to write about it was easy. After that, I’m not that smart, so I have to break complex things down so I can understand them myself. So I think that by breaking things down and looking for meaningful examples, people seem to appreciate what I’ve written (or I hope they do).

After I wrote the Scala Cookbook and people sent me notes like that, I struggled with writing for a little while. Then I decided to just try to write for a younger version of myself and ignore what other people were saying. I just ask myself, “Would this have helped Al 2+ years ago?” Since then I’ve been fine.

Don’t objectify me

As a brief note today, here’s an example of stackable modifications using traits in Scala.

What is ‘super’ in Scala when you mix in traits?

I was curious about what super means when you mix Scala traits into a class or object. A simplified answer is that super refers to the last trait that’s mixed in, though I should be careful and note that this is an oversimplification.

You can demonstrate this in an example that uses both inheritance and mixins with traits. Given this combination of traits and classes:

I’m horrible at date calculations — what do you mean by “between”? — but I do know that April 10th is the 100th day of all non-leap year years.

Happy 100th Day of 2019

Her, romantically: I can feel you tremble when we touch.

Me: Oh, sorry, that’s just the mast cell disease.

(A conversation somewhat inspired by the Survivor song, I Can’t Hold Back.)

Note: The print version of Hello, Scala on Amazon will be going up to $20 (USD) this Saturday, April 13, 2019. It’s currently just $10, so you know, buy it while it’s on sale and all that. :)

If you like free things, here’s a link to a free preview (PDF) of the new version of my book, “Hello, Scala.” The book is 257 pages long, and the free preview contains the first 120 pages of it, so I hope it’s a significant preview.

July, 2019 Update: Hello, Scala was previously available in PDF and Kindle versions, but hopefully there are some big changes coming, so those versions are no longer for sale.

Hello, Scala (free preview)

“Never argue with a fool. Onlookers may not be able to tell the difference.”

~ Mark Twain (used recently in reference to Antonio Brown on Twitter)

I don’t recall hearing of the words “reify” or “reification” in my OOP years, but that may be because I studied aerospace engineering in college, not computer science. Since learning functional programming (FP) I often see those words, so I thought I’d try to understand their meaning.

Background

I ran into the word “reify” when I saw code like this:

trait Foo {
    //...
}

object Foo extends Foo

I’d see code like that then someone would describe that last line as a “reification” process.

What “reify” means

The short answer is that the main definition of reify seems to be:

“Taking an abstract concept and making it concrete.”

For the longer answer, I found the following definitions and examples of reification.

“When you see a plum blossom, or hear the sound of a small stone hitting bamboo, that is a letter from the world of emptiness.”

A quote from a Lion’s Roar article, Shikantaza is Understanding Emptiness.

One of the many things I like about Scala is that you can make it as complicated as you want to, but you can also write a little code like this and show it to someone who has never written a line of code in their life, and they can pretty much tell you what’s going on.

Making Scala simple for beginners

Just saw that Guns n’ Roses will be playing at the Louder Than Life festival in Louisville, Kentucky this fall.

Guns n’ Roses in Louisville, Kentucky

Lyrics from the Genesis song Undertow, which just came across my random playlist:

Better think awhile
Or I may never think again.
If this were the last day of your life, my friend,
Tell me, what do you think you would do then?

Stand up to the blow that fate has struck upon you,
Make the most of all you still have coming to you,
Lay down on the ground and let the tears run from you,
Crying to the grass and trees and heaven finally on your knees.

Let me live again, let life come find me wanting.
Spring must strike again, against the shield of winter.
Let me feel once more the arms of love surround me,
Telling me the dangers past, I need not fear the icy blast again.

“Write shy code — modules that don’t reveal anything unnecessary to other modules and that don’t rely on other modules’ implementations.”

~ Dave Thomas

I get to be radioactive again in a couple of weeks. I heard them say “gamma,” so I’m hoping this has to do with a childhood Christmas wish regarding The Incredible Hulk.

Going to be radioactive again soon

This is a note that I originally posted here in 2014:

I learned yesterday that my endocrinologist wants me to take a dose of radioactive iodine in about two weeks as a followup treatment for the total thyroidectomy surgery I had two weeks ago. I did some research before and after my meeting with her, and was surprised/amazed to read things like this.

Radioactive iodine warnings

contributors.scala-lang.org remains my favorite website of late. This pre-SIP discussion looking for better ways to define a `main` method is a fun read that demonstrates a collaborative process.

Scala/Dotty SIP process: A better `main` approach?

“The limits of what we know, that’s something you can get lost in.”

~ from the tv series Limitless

Today’s song of the day is When You’re Gone, by the Cranberries.