Writing code is fun. Period. If someone tells you otherwise, they’re probably lying, frustrated, or gatekeeping (permutations are a possibility.). However, as any skill you can develop in life, you have to be conscious about the environment and the requirements of that particular environment.
Programming is one of those things that change the way you think and see the world around you. With programming, you gain a dramatically different idea of how and why you interact with technology, and the endless permutations you can create with code.
The sole concept of perfect code should be something that every programmer must know to avoid and, in many cases, learn to let go. For many, this involves asking questions, seeking feedback, and learning from others. Have you looked at the Linux Kernel codebase? If not, you totally should! It is an example of how software is crucial to humanity’s advancement.
This is a fragment from one of my favorite pieces from Rachmaninoff: Piano Concerto No. 3, with just the right amount of complexity.
In music, adding complexity is up to the composer, and it may improve (or not) the overall piece into achieving the feel and exact essence of what the musician wanted to include in their masterpiece. It may be applauded, it may not. The key is learning how to read complexity itself, and not be overwhelmed by it. This concept can be applied to programming as well.
Complex code is being changed nowadays. It is being analyzed, erased, rewritten, and refactored to make it more accessible and inclusive. There will always be non-simplifiable systems, as programming is about modeling the world around you, and the world isn’t simple. But the complexity we’re addressing is self-imposed.
In both music and programming, the concept of elegance is essential, referring to the ability to add and remove the exact amount of complexity. Programming is, for the most part, a journey where you get to read billions of lines of other people’s code, and it’s essential to strive for readability.
When you start writing code in the way you’d like to read code, that’s when analytical, logical, and overall elegance kicks in. You are no longer an agent of chaos, but a helpful contributor that acknowledges code as what it is: a language.
As you read more code, you become more conscious of the abstraction techniques and capabilities of each language and how, when, why, and where to apply them. Strive for readability, not just because some random person on the internet is telling you so, but because readability benefits everyone in the programming community.
As always, thanks for reading. For comments and feedback, you can find me on Twitter as: @humbertowoody.