The Haiku Approach to Writing Software

Haiku is a traditional form of Japanese poetry that follows a specific set of rules. They are designed to evoke deep emotion or understanding using only three lines and a fixed number of syllables. For example:

First autumn morning

the mirror I stare into

shows my father’s face.

- Murakami Kijo

As my experience as a software engineer grows, I have found myself writing better software by approaching it as I would a haiku. Here are some of the lessons I’ve learned along the way.

Understand the constraints up front

When we build software, we must often operate within a narrow set of constraints. The constraints may include the business requirements, the technologies at our disposal, the skillset or bandwidth of the team, and the time we’re given for actually creating the software. Whether you’re writing a haiku or software, if you ignore the constraints of the project, you will have trouble producing what you set out to create. Instead of ignoring the constraints, aim to create something powerful or beautiful within them.

Start strong since early decisions can impact the final product

There’s a lot of freedom in the initial stages of a project. Many engineers approach a new project in the way a painter may approach a blank canvas. They lay down some initial, wild brush strokes in the code base with the intent to return later and add more structure or detail. This painterly approach doesn’t always translate well, as the initial brush strokes often don’t get layered upon at all, but are instead annotated with TODO -style comments and become permanent fixtures in the code base.

The haiku approach is to be careful and intentional with early decisions, so that they become a strong foundation for everything that comes after. In other words, don’t write the equivalent of the following haiku in your software.

Something something // TODO

the mirror I stare into

shows my father’s face

Keep it as simple as possible

Unnecessary complexity can ruin a project. A haiku represents a body of work with all of the fat trimmed. Your code base should be approached with the same care, as complexity threatens the long term maintainability of your project and makes it easy for bugs to hide.

Simplicity is not always easy to achieve. In fact, it is often easier to write too much code than to find simpler, more efficient implementations. For the reasons stated above, it’s worth the extra effort to trim this extra fat from your code base and keep it as succinct and simple as possible.

Engage the creative side of your brain

Writing software is an art form. It requires creativity, good decision making, and a lot of hard work. If you are uninterested in the project or the medium, it will be reflected in the final product. If you allow yourself to be challenged creatively, as a haiku writer would, you will be giving yourself an opportunity to create something impactful for your customers or business while having fun in the process.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store