An insight into beautiful code
Through my journey as a software developer I have always cared for the aesthetics of my code; be the spacing between lines, naming conventions, or the structure of a project - much like a wordsmith or a sculptor - there is the pursuit of something beautiful, creative and expressive.
Now that I think about it, though it can be intuitively understood, we struggle to describe beautiful code in a coherent set of qualities.
In general, it’s often outlined as concise, simple and pure. Those could imply the code follows well designed patterns and architectures, it uses just the right amount of abstractions, the writing style is the same throughout, or is.. pure, whatever that means. I would also add performance and execution to the list, as it seems like, if the code either doesn’t fulfill its due or isn’t performatic at all, it tends to be “uglified”.
From this perspective, beautiful code is much closer to craftsmanship than art itself; as we strive to continuously write better software, we exercise and reinforce the good habits.
Despite that, I feel like there’s something missing, a substance that fills and ties those pieces together, the point that makes a vase be placed in an exhibition instead of used as weight for holding your entrance door.
I believe what gives this substance to code is the intention behind it; what problems does it solve? How does it solve them? This is what brings out the novelty, ingenuity and creativity, it flourishes admiration and makes us think “I wish I had thought of that”.