# Open source dramas

Just some commentary on some months-old dramas.

A couple months ago there was some drama in the Clojure community. An excellent summary can be found in eccentric_j's top comment on this reddit thread.

The TLDR is that someone got sick of how difficult it was to make contributions to Clojure and ragequit (politely), then Rich made this "it's not about you" post, and then a few days later as if to rub salt in the wounds REBL was released with a non-open-source license.

# Self-documenting code

I read Uncle Bob's Clean Code book last year, and one of its examples in the final summary chapter on the importance of naming stuck with me. I mean, most people will just agree that naming is important, but sometimes convincing is needed, and the examples given are either trivial (i.e there's really not a naming problem) or convoluted (you'd never write code that way to being with, even with good names). Bob's example looked like it was going to be the second kind. Have a look:

public int x() {
int q = 0;
int z = 0;
for (int kk = 0; kk < 10; kk++) {
if (l[z] == 10) {
q += 10 + (l[z+1] + l[z+2]);
z += 1;
} else if (l[z] + l[z+1] == 10) {
q += 10 + l[z+2];
z += 2;
} else {
q += l[z] + l[z+1];
z += 2;
}
}
return q;
}


A loop with a few if-elses in it. A reference to some higher-scoped array l. Some magic numbers. What does it mean? Would anyone ever write this? I can tell you what this code does on the machine, I can't tell you what it "does". Its purpose. Its meaning.

# Jump Game As Interview Problem, Domain Solutions

Over on LeetCode, there's a problem known as the Jump Game.

Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.

Example 1:
Input: [2,3,1,1,4]
Output: true
Explanation: Jump 1 step from index 0 to 1, then 3 steps to the last index.

# Intangible costs matter in compensation packages

If you commute to work by car, what would you rather have: free parking or a $4k increase in annual salary? Note that if you pay$15/day for parking, and take no days off, that comes out to \$3900. So the raise is strictly more than the cost, even.

I would pick parking. That's because even though raise > parking_cost, the actual comparison is raise vs. parking_cost + intangible_costs.

# The mythical C and C++ replacements

I watched this recent talk by Bryan Cantrill, and thinking about it got me to write up some older periodic thoughts. It's probably worth reanalyzing this topic every few years (especially if I look deeper into any of the languages listed below) but consider this the first one.

Unlike Bryan I'm more interested in the theoretical replacement language for game programming rather than systems programming. The big "enemy" here is C++, but C is still very common especially at the library and middleware layers, so I think we're in alignment in generally aiming at C and C++ together.

# Ramblings on data structure literals

I've been stewing a bit about Clojure's pretty data structure literals, and finding myself wanting them in other languages. In Common Lisp, maybe enough to use one of the various reader macros for maps. But what is it I really want?

In PHP, you used to have to do array() to make a new array or list. You could have data literals though: array(1, 2) for lists/arrays, array('foo' => 3, 'bar' => 4) for maps. It worked for me. I didn't need literal syntax for sets or anything else.

Later on I learned Python, I prefer the syntax a bit more. (1,2) for a "tuple" (list), [1,2] for an array/list/stack/queue/... very versatile, {'a': 3, 'b': 4} for a map. In JavaScript it (can) be about the same for arrays and maps, though you can leave off the key quotes for maps, but leaving them there (and using double quotes) has the nice side-benefit of being more likely to be valid JSON. It depends on whether your value is something serializable or not of course.