Rewrite code to make it stronger

From The Incomparable podcast episode 354: Sons of Caledonia.
Dan Moren talking about writing a novel (audio):

The amount of time you spent writing that first novel… rewriting it is going to be more, probably.

It’s like playing Jenga, right? It’s like: “Oh my God, if I take this brick out right here, will this whole thing fall over?”

It’s trying to get yourself out of this mindset of: “Oh, my story is this delicate spiderweb, and if I break this one strand, the whole thing will fall apart.”
And trying to get yourself more in the mindset of: “My story is like a piece of iron, that is being worked in a forge.”

Where you’re hammering on it to make it tempered, to make it stronger than the thing it was originally.
Like you take a sword, and it’s all about folding the metal, hammering it, and trying to reinforce it. To the point where it’s not going break immediately. You can hammer on something pretty hard. To try to sort of work in the right shape.

That’s what you’re going for, when you’re rewriting. Otherwise, you just sort of get paralysed with fear that anything that you change will break everything. That’s not the case, stories are pretty resilient in that way.
And you can always fix it, is the good news.

This really resonated with me when I heard it. I think this applies equally to writing code as it does to writing in general.

Writing code is like writing a novel. The first iteration of the code that passes the unit tests, is just the very first draft. Now you can start rewriting.

“Jump to Definition”-shortcut not accessible

The “Jump to Definition”-shortcut is not accessible for left-handed users in Xcode 9. There’s no Ctrl key on the right hand side.

Photo of left hand on Macbook trackpad, with right hand crossing above to press ctrl-key on left hand side

I’ve filed a radar with Apple:

ID: 33004913


In Xcode 9, “Jump to Definition” shortcut is now Ctrl+Cmd+click (was Cmd+click in Xcode 8). On a MacBook keyboard, there’s no Ctrl key on the right hand side. This makes the shortcut not accessible for left-handed users.

Steps to Reproduce

Use MacBook trackpad with left hand.
Hold Ctrl+Cmd down with right hand, while clicking source code token with left hand.

Expected Results

Easy access to “Jump to Definition”-shortcut.

Observed Results

On a MacBook, it is very difficult to hold Ctrl+Cmd with right hand, while clicking with left hand.

This requires crossing hands over each other.


Xcode 9 beta 1


Suggestion: Use Cmd+Option+click instead.
Option button is available on left and right hand side of keyboard.


Relevant to at least US and International Dutch keyboards.

Outdated advice

“Always program against an interface” is outdated advice from the days of Java and C#. This doesn’t apply in languages like Kotlin or Swift.

There’s no need to define an interface at the same time as a concrete type. With extensions, existing types can confirm to new interfaces.

Just program against concrete types, and only introduce a new interface when you actually need the indirection.