Intention

The primary thing when you take a sword in your hands is your intention to cut the enemy, whatever the means. Whenever you parry, hit, spring, strike or touch the enemy's cutting sword, you must cut the enemy in the same movement. It is essential to attain this. If you think only of hitting, springing, striking or touching the enemy, you will not be able actually to cut him.
Miyamoto Musashi

Today I had a few reasons to think about good and bad software design. Often, badly designed software is designed badly. That might seem tautological, but there's another, very common way that badly designed software happens: when it isn't designed at all. For these projects, there's no overall vision. Things just... happen, and after enough things have happened, you have your software. It mostly works, but it is missing that particular quality that well designed things seem to need: intention.

Intention is the quality of something that is done for a reason, and whose various decisions and actions are aligned toward that reason. It may sound obvious – why would you do things without a reason? – but it is surprisingly common that people do things for no reason at all. They'll often have a goal, and often they'll take actions or make decisions, but those actions aren't actually designed to achieve the goal. That link between goal and action is intention.

A lack of intention seems to be a particular hallmark of large, long-running software projects. Perhaps at the beginning individual people exercised intention over the software, but some of them leave, new people come in, and often the same code is changed by many different people with different goals. The invention of the product manager was to some degree a response to this problem; that person is tasked with maintaining the intention of the software at a product level. But many projects still don't have a product manager and, even so, who is maintaining intention at the level of the code itself?

That said, software doesn't have to be in a team to lack intention. One of the most amusing phenomena is Eliezer Yudkowsky's Guessing the Teacher's Password, where students just say correct-sounding words in the hope that they'll happen upon a correct answer. The most common expression of this in programming is Shotgun Debugging, where you have a bug and just make changes at random until it fixes itself. You wanted to fix the bug, and you did fix the bug, but your fix had no intention.

In a more general sense, it seems easy to inadvertantly act without intention. You pick some course of action and follow it because it seems good, never mind whether it actually brings you closer to your goal. I don't even mean that it doesn't, but rather that you never even thought to check. And while you can certainly still do things without intention, it's hard to imagine those things ever being more than mediocre.