humancode.us

Go Small to Go Big

November 29, 2023

When I’m in the zone coding, especially if it’s a moderately complex program that I understand well, I get hyperfocused. It’s really hard for me to put the project down. The idea for the next building block, the next simplifying refactor, the next feature burn in my brain, and I need to get it out and into code. It is challenging when I have other important tasks to do, people to take care of, or if I have to eat or sleep.

The danger with obsession is of course to rathole—to push yourself beyond your optimal cognitive load, to hyper-optimize, to push a feature too far, too early. I spent a whole day this past weekend implementing a major refactor that ended up being entirely wrong-headed, and I had to git reset --hard and admit defeat. My current implementation is much like the original, just slightly more finessed.

One way I address this (which I forgot to do this past weekend) is to take a grand idea and apply it to something as small as possible. Want to rearchitect a whole class cluster? Try modifying one method in one class. Want to refactor 10 files? Do it with one. Want to rewrite a function that is too large from scratch? Extricate one if branch instead. Want to add a utility library? Start with one function in an empty file.

For me, it turns out that what drives my burning obsession is a constant desire for a taste of progress. Turns out that small progress is far easier to achieve than large progress, so breaking down a grand vision into its smallest possible manifestation allows me to make some progress quickly and satisfy my thirst, and also cheaply test whether the improvement was worth it in the end—and if not, the amount of work discarded would also be small.

Making the smallest possible change that implements your grand vision has a wonderful side effect of making each of your commits do only one small thing. The smallest implementation of your refactor could literally be “Rename foo to bar”, which would make a fine commit message: clear and descriptive. “Reparent Foo class cluster and protocols” on the other hand, will probably be a huge mess of a diff. It’s better to have a commit log of 20 tiny isolated changes than one big one.

So I’m committed to focusing on small progress from now on. When it’s time to step away for meals, to socialize, or to take a walk, I would be satisfied to see that I’ve pushed five small changes to the repo, representing five steps toward a grand plan—a plan that I can now revise with the hindsight of testing if those first five steps were going in the right direction. Because paradoxically, small steps let you make big changes faster.

Dealing with a veiled emotional rejection

September 17, 2023

When someone keeps asking you for more data, documentation, or justification for your change request, it’s because they don’t want to accept the change at an emotional level. They are cloaking their reluctance in a veneer of intellectual superiority.

An actually neutral party would make an attempt to appreciate your point of view, then show you a path to their acceptance, and not continually challenge your request.

When you see this coming from some party, admit plainly (in private, if it helps them save face) that you have a philosophical disagreement with them, and ask them to engage honestly at that level. Do not play the game of attempting to satisfy their incessant demands. There is no end to them.

More thoughts on remote work

August 28, 2023

What a great illustration of the perversion of capitalism: someone who owns two restaurants in downtown Minneapolis is asking Target to force thousands of employees to spend literal pieces of their lifespan every day (and polluting and adding to traffic and wearing down/depreciating their cars in the process) to return to office so that their restaurant business model continues to be profitable.

The remote work revolution is likely unstoppable: thanks to three years of lockdowns, workers now know that rote commuting is a waste of time. Flexible and remote work allows more work-life balance and costs everyone less to produce the same output.

The forces against remote work are almost entirely reactionary: a desire to return to the Old Ways, to Manage By Walking Around, to go back to the Old Business Models, to save Commercial Real Estate; in other words, to save old capital.

Read more…

Exposing Swift implementations to Objective-C

August 9, 2023

In this post I describe a recipe for exposing symbols implemented in Swift to Objective-C through a header file. The symbols supported are:

  • Functions
  • Classes
  • Categories
  • Protocols
  • Enumerations

If you want to go straight to code you can use, check out my github project.

Read more…

How to never miss a shift when driving a manual car

July 14, 2023

Car Nerd Time!

If you drive a manual transmission car you owe it to yourself to learn the “open palm” technique to eliminate missed shifts, especially during high-performance track driving.

The secret to never missing a shift is to not grip the shifter. If you do, bumps and jostles will easily shift the lever into the wrong position. Keep your palm open and relaxed, and be sure to apply forces only in the directions that result in a proper shift.

The open palm technique involves positioning your hand in various orientations and contacting the shifter only in certain locations that always result in the correct gear selection. After some practice, this will become so natural and subtle that you’d be able to do it without a thought.

Here’s what I mean. For these examples, I assume you’re driving a left-hand-drive car (e.g. US) so you’re using your right hand to shift. I also assume a standard H pattern, not a dogleg.

Read more…

< Newer Posts