The Forgotten Art of Good Code

In the era dominated by AI and automatically generated code, are we sacrificing quality of deliverables for speed and simplicity?

3 min read
by Ian S.
Photo by Avi Richards on Unsplash

The buzzword for some years now is “AI”. AI here, AI there, AI “even in the soup” as we would say in Panama. And yes, AI has revolutionized the lives of many of us and the engineers who, in many cases, use AI tools as support.

Exactly 15 years ago, when I had the opportunity to work with a team of very good engineers (several who I consider my mentors and friends), one of the first things they put in my hands were three books:

  • “Hackers and Painters”, by Paul Graham
  • “The Clean Coder”, by Robert C. Martin
  • “Clean Code”, also by Robert C. Martin

The first taught me to think like an engineer, to understand that programming is an art and that the best engineers are those who can combine logic with creativity.

The other two books taught me the importance of writing clean, maintainable, high-quality code.

I, a self-taught software developer with an academic background in Electronic Engineering, thought I knew how to write code. The splash of cold water I received from reading three simple books was monumental (plus it also brought me home to the reality that I was just starting my career).

#.“Fast” fashion

And, it’s not for nothing, but we have gone from trying to repair things: to buying new ones. We have gone from reading newspapers or news to finding out what is happening on Twitter, or X, or whatever it is called now. We want everything fast, easy and without complications.

The same thing happens with the code.

Instead of sitting down and thinking, with a piece of paper, a pencil, some highlighters, a coffee and maybe a couple of cookies, about how to solve a problem that might take a few hours or a few days: we now open ChatGPT and say “write some code that does X.” And, of course, AI does it. But what about the quality of the code? What about maintainability? What about the art of writing good code?

Good code usually takes time, effort and dedication and we reject this for immediacy.

#.But what is good code?

A very complicated question, to which Robert C. Martin has a very simple answer: it is “clean code is code that looks like it was written by someone who cares”, it is code that reads like “good prose”.

And I prefer this simpler way of thinking, rather than the harsher way of “write code as if the person who is going to maintain it is a psychopath who knows where you live.” Good code is one that:

  • It can be read easily.
  • It can be easily understood.
  • Can be easily maintained.
  • Can be easily extended.

But doing this is not always easy, especially when pressure for quick delivery or lack of familiarity with the context leads us to take shortcuts.

And, this is what commonly happens when we use AI tools to generate code: quick, poorly thought-out solutions that often do not meet the quality standards that a good engineer should follow.

#.Bootcamps, courses and AI: explosive combination

Before it gets misunderstood: I think Bootcamps are a great way to start programming and fall in love with the magic of producing code and seeing things start to work.

But well, many of these Bootcamps teach only the technical part of the code and many of those who attend these courses avoid delving into the philosophy that good code is not only engineering, but also an art.

And, if we add to this AI, which gives us quick and easy solutions, the result is a generation of “engineers” who focus more on the speed of delivery than on the quality of their work.

#.So what do we do?

The answer is not simple, but I think we need to go back to the basics and understand that software engineering and the art of writing code are two sides of the same coin.

That quick and easy solutions are not always the best. That producing quickly does not mean it is good. That we must take the time to think, to plan, to write code that not only works, but is also maintainable and of high quality.

If you are a software engineer who is just starting out, or someone who already has some time, try to sit down at any time today and think about how to solve, on your own, a problem you have in your work.

And yes, maybe the sheet of paper, the pencil, the coffee, the highlighters (and the cookies, don’t forget the cookies) will help you find a cleaner, more maintainable and easier to understand solution. And if after you have this idea, you want to use an AI to help you perfect the code, go ahead! But remember that AI is a tool, not a replacement for the engineer.

And another thing: humility. Don’t think you’re the best engineer in the world because you wrote code that works. There is always something new to learn, there is always a better way to do things. Listen, read, ask and never stop learning.

This was written by hand and not by an AI 😀.