It is important to write beautiful code.
The field of software engineering is inherently aesthetic. Beauty is an insatiable motivation, and embracing the pursuit of beauty as a priority in our work will make us happier and more productive.
The pursuit of beauty is abstract. Yet this abstractness and unknowability does not stop a composer or a sculptor in their pursuit. Rather it fuels them.
The beauty I mean is not the beauty of purpose and idea, nor of the user interfaces, nor the layout of well formatted code. It is the shape of algorithms, design patterns, formal logic and the flow of information.
Writing software has a strong parallel to writing music. In both disciplines you have a series of constraints, you leverage existing patterns to structure your ideas, and events occur in time. But in music, the mechanics of composition are learned and then the composer begins their real education, a lifetime spent in the pursuit of beauty.
As a composer, the constraints and the structure free me to be creative. I am creating something that has never existed and it is thrilling. But as a programmer I often do not feel so empowered. Rather, I feel like a conduit for ideas that already exist out in the ether. I have a functional objective and a set of tools and I need only connect the dots.
How foolish this is. We are creators, we are inventors, and we are artists. Our medium is information. We shape it and move it around in time. We give it context and enrich it, we produce and delete it. We sculpt with electricity and oscillation, and it is a beautiful thing to consider. Each line of code we compile has physical consequences in the world. It is up to us to make those consequences beautiful.
It is easy to think that at the end of the day, all that matters is that data gets from point A to point B, that thinking of yourself as an artist is frivolous and a waste of time. But the pursuit of beauty is its own objective. Such a pursuit is what attracted me to this industry. It isn’t the completion of tasks that gets me excited, but rather the prospect of creation.
It isn’t necessary to have a definition of beauty to pursue it (if it was, no music would ever get composed). Rather, the act of writing software, or music, is the pursuit of such a definition. We try ideas, sometimes they blow up, sometimes they touch a nerve and leave us grinning and doing silly dances in the hallway.
This is not to suggest we withdraw from the world and work on over-engineered masterpieces that no one will care about. That’s not how beauty works in our industry. We will have to compromise our aesthetics and write elevator music from time to time. We will have to use a language we don’t care for and meet deadlines. Just don’t forget that under any such frustration is a world of beauty to be explored.
The pursuit of beauty is permission to be bold and silly. It is the difference in following a recipe from a cookbook and taking the recipe and adding some paprika and cinnamon because you are excited about what you might discover. The insatiable drive to discover is what makes a chef great. In engineering we tend to think less about ‘discovery of the new’ and more about ‘learning about the existing’.
Let’s discover more.