Quick bits:
-
I woke up in the middle of the night to screechy screaming. I looked through the window and I saw a fox having a battle with a random plant. Ahh, foxes. What goes on in their tiny heads? Nobody knows.1
-
I mentioned last week that my keyboard layout kept reverting to QWERTY. That stopped — when it started reverting to Colemak instead, at least until two days ago when it magically fixed itself and now sticks properly to my chosen keyboard layout. Very strange.
Meanwhile, I’ve moved on to Tarmak-2. Hopefully the transition isn’t too painful. There might be a typo or two sneaking into my
weeknogesweeknotes. -
I've been using Mochi as my flashcards-slash-spaced-repetition tool, and it’s been great. But it only works well if you use it consistently. I’m using it for learning my lines (acting, you know) and I appreciate the inherent randomness.
-
This week has been incredibly busy with the job search to the point of having little time for much else. Still no news about a new job at this point, however.
-
I’ve made little progress on Deng this week. I’ve added support for
{% else if %}and{% for … %}, both of which turned out to be remarkably tricky to implement. I’m surprised by how much work all this is. -
I signed the open letter to the Rails Core team and Ruby community. David Heinemeier Hansson is a blight on the Ruby/Rails community.
This week, I realized that my software development philosophy2 on naming has parallels with my philosophy on mutability.
In general: names need to be descriptive (e.g. b is vague, while pngByteBuffer is clear). However, the smaller the scope, the less descriptive the name needs to be. Take this code snippet as an example (in a fictitious language):
for (var i = 0; i < rawImageBytesArray.len; i++) {
var b = rawImageBytesArray[i];
buffer.append(b);
}
The variables i and b not descriptive, but their scope is incredibly small (3 and 2 lines, respectively). Renaming i to rawImageBytesArrayIndex could even be counterproductive, as it takes more effort to interpret. My general line of thinking is that the smaller the scope of a name, the shorter that name can be.
Mutability has a similar story. Imagine a map function, i.e. a function with the following signature:
fn map(inArray: Array, transform: fn) -> Array {
// ...
}
Such a map function returns an immutable array, and it does not mutate the incoming array. From the outside, it seems there is no mutability anywhere. But inside the map function, the story can be different:
fn map(inArray: Array, transform: fn) -> Array {
var result = new MutableArray(
capacity: inArray.len
);
for (inArray as elem) {
result.appendAssumingCapacity(
transform(elem)
);
}
return result.freeze();
}
The result array is mutated, because it is efficient to do so. The returned array, however, is no longer mutable. As with naming, my general line of thinking is that the smaller the scope of a variable, the more it is acceptable for that variable to be mutable.
Global mutable state? Yuck. Global constants named y? Gross. But short names and mutable state in very specific small scopes can increase readability and performance, and that’s never a bad thing.
Entertainment:
- Escape from New York3 is remarkably cheesy, though perhaps that was to be expected from a early-’80s movie. Film-making sensibilities sure have evolved.
Links:
-
The War on Science (Shaun)
-
Beaver-engineered dam in the Czech Republic: Is someone going to pay the beavers now?
-
the sham legacy of Richard Feynman (Dr. Angela Collier): Whoa! (Also, how many hours have I spent this week watching Angela Collier videos? Erm. A lot. She’s good.)
-
My documentary about White Supremacy. White Right: Meeting the Enemy. (Deeyah Khan): This was hard to watch, but also so worth it.
Tech links:
-
Ruby Central is Not Behaving in Good Faith, and I’ve Got Receipts (Jared White) / Shopify, pulling strings at Ruby Central, forces Bundler and RubyGems takeover (Joel Drapper): Ruby drama part 1. Blah.
-
The Ruby community has a DHH problem (Tekin Süleyman): Ruby drama part 2. Blah.
Fun math links:
-
We have statistical evidence that people are mildly psychic (Stand-up Maths)