code

How Twitter built Scala tools to scala to millions of lines of code alvin June 24, 2018 - 6:36pm

If you like reading PDFs of presentations, here’s a PDF from a Twitter employee named How We Built Tools That Scale to Millions of Lines of Code.

Quotes from Clean Code

Back in 2013 I read the book Clean Code by Robert C. Martin, and in an effort to keep that book alive with me a little while longer, I decided to make my own “Cliffs Notes” version of the book on this page. One of my favorite notes from below is that a language named LOGO used the keyword to in the same way that Scala uses def, so a method named double would be defined as to double... instead of def double..., which seems like it would help developers name methods better.

Making wrong code look wrong (Joel on Software)

A long time ago — 2005, to be exact — I read this article named Making wrong code look wrong, and it was a big influence on me. These days I don’t know how many people use variable naming conventions, but when working on web applications I still like the “us” (unsafe) and “s” (safe) convention for handling user input. As Joel Spolsky discusses in that article, that convention has a good way of making wrong software code look wrong.

Scala idiom: Prefer immutable code (immutable data structures)

(I originally wrote this blog post in 2012, and it seems like it has held up well over time.)

One great thing I’ve learned from Scala and functional programming over the last few months is this: 

Make your variables immutable, unless there’s a good reason not to.

“Immutable” means that you can’t change (mutate) your variables; you mark them as final in Java, or use the val keyword in Scala. More important than you not changing your variables is that other programmers can’t change your variables, and you can’t change theirs.

Show me your flowcharts and conceal your tables ... alvin October 20, 2017 - 8:19am

“Show me your flowcharts (source code), and conceal your tables (domain model), and I shall continue to be mystified; show me your tables (domain model) and I won’t usually need your flowcharts (source code): they’ll be obvious.”

~ Fred Brooks, “The Mythical Man Month

Margaret Hamilton, Apollo software designer, next to her code alvin July 21, 2015 - 11:47am

As the caption says, Margaret Hamilton, Apollo flight software designer, stands next to a tall stack of software code that was printed out, circa 1969. Image from this Twitter page.

Update: There’s more about Margaret Hamilton on this vox.com page.

How to paste and load blocks of code in the Scala REPL

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 14.2, “How to paste and load blocks of code in the Scala REPL.”

Problem

You want to experiment with some code in the Scala REPL, and typing it in or trying to paste it into the REPL won’t work.