style

Scala style: Side-effect methods with no parameters should be declared with parentheses

As a note about Scala style, this Scala page strongly encourages that side-effect methods that takes no parameters should be declared with parentheses:

“However, this syntax (leaving off parentheses) should only be used when the method in question has no side-effects (purely-functional). In other words, it would be acceptable to omit parentheses when calling queue.size, but not when calling println() (or openGarageDoor()). This convention mirrors the method declaration convention given above.”

“Religiously observing this convention will dramatically improve code readability and will make it much easier to understand at a glance the most basic operation of any given method. Resist the urge to omit parentheses simply to save two characters!”

Hemingway: I did not know how I would ever write anything as long as a novel

“Since I had started to break down all my writing and get rid of all facility and try to make instead of describe, writing had been wonderful to do. But it was very difficult, and I did not know how I would ever write anything as long as a novel. It often took me a full morning of work to write a paragraph.”

Scala “lint” tools

As a quick note, I was just looking into the state of Scala “lint” tools, and found ScalaStyle, WartRemover, and Scapegoat.

This 2014 underscore.io post states, “Those interested in FP purity in a Scala world, you’ll want WartRemover.” (Of course that recommendation may have changed by now.) The current ScalaStyle website states, “Scalastyle is used as part of the grading framework for the course Functional Programming Principles in Scala by Martin Odersky on Coursera.”

How to create outlined text using Gimp

Here’s a quick look at how to create outlined text using Gimp. I don’t know if that’s the right term, but I’m thinking of the large white text you see with a black border that you usually see on meme images.

Here are the steps I just used:

  • Select the text you entered, such as, “I USED A var”. Make sure the Text Tool is active.
  • Click the “Path From Text” button in the Text Tool panel.
  • Click the Select menu, then “From Path”. You should see some action on screen here.
  • Create a transparent layer, move it below your text, and make it active.
  • Click Select, then Grow...
  • On the popup dialog, enter 3 pixels, 5 pixels, whatever you need for your font. When you click OK you should see the selection area on screen change size.
  • Click Edit menu, choose “Fill with BG Color”, or “Fill with FG Color”.

If you use a white font with a black background color, your image should look like this: