Building software is more like creating a work of art, it requires creativity in design and ample craftsmanship to complete.
Don Wells made this statement in his essay Agile Software Development: A gentle introduction at www.agile-process.org. He made the statement in the context of contrasting agile software development processes to those of older, more ridged processes. But the thing that really caught my attention was that he likened writing code to art…and said it was something that required craftsmanship.
Another great quote on this idea is from Structure and Interpretation of Computer Programs by Harold Abelson, Gerald Jay Sussman, and Julie Sussman (https://mitpress.mit.edu/sicp/full-text/book/book-Z-H-7.html):
Thus, programs must be written for people to read, and only incidentally for machines to execute.
This statement was made in the context of convincing readers that computer languages are a good medium for expressing complex ideas. Again this notion of expressing one’s self through computer code.
‘Code as art’ is something I have believed in for a long time. Writing good code is a creative outlet and form of personal expression for many — myself included. I posit that if you treat your code as art and take pride in both its form and function, it will be of better quality. Why? Because you have put the pride of craftsmanship into your creation. It is an expression of who you are.
Have you ever had to maintain someone else’s code? This is something that companies like Armedia are asked to do all the time. I find it disheartening to review code that has no logical form or function; the indents are haphazard, the variable and method names make no sense, style elements are inconsistently applied, and there are no comments. Someone obviously just threw this together, and didn’t care much about it. My first reaction to code like this is “Yuk”, and I immediately have to squelch a low opinion of the author who didn’t demonstrate any craftsmanship.
On the other hand, it is a real pleasure to crack open software that reads like prose. Even if I don’t understand the nuance or logic of every method, I get the gist by simply reading the variable, object and method names. The consistent application of style and indents make it look beautiful on the page as well as make the logical structure obvious. I admire code like this for the care and workmanship its author imparted to it. Readability is certainly one factor that goes into highly-crafted, artistic code. Here is a great blog on the readability of code with some good and bad examples: https://www.codesimplicity.com/post/readability-and-naming-things/.
To me, writing software is a creative process as much as it is a logical one. It requires both the left (logical) and right (creative) sides of your brain – if you write code like prose and make it beautiful. Without the beauty, it’s just left-brained. It might work, but lacks the beauty to inspire. I strive to create beautifully crafted code every time I sit in front of my IDE. I want readers to appreciate not only the function of the code, but its form – the craftsmanship and artistic expression that went into its creation.
So, how do you approach your code? Do you just throw it together to get the job done, or do you craft it into something that reads like prose? Writing software is akin to crafting a highly functional piece of art that can profoundly affect people’s lives. If you take the time and pride to turn your code into prose, I believe it will function better and certainly will be easier to maintain. I urge you to take pride in what you create. You will receive more satisfaction as a developer, and your peers, customers, and employer will appreciate you for the high quality of your product.
(Perhaps a bit extreme, but cool nonetheless: https://www.perlmonks.org/?node=camel+code).