Treat Your Code As Your Masterpiece

Code usually is just plain text on an editor. Code is considered boring geek stuff.

Yes, code is just text. Usually in a boring monospace font. But code is a crafted artefact that deserves passion and attention.

Every developer should start treating code as an art piece. His own art piece.

What if Van Gogh treated his paintings as random drop of paints or Murakami treated his books as a bunch of printed words on paper?

Creating code that is a piece of beauty is our duty as developers.

If it’s not challenging, challenge yourself

Creating a quality product should be a duty in every field. Why would someone spend time creating something that is not as beautiful as possible?

If you are working on something, but you can really be bothered, just stop. Not having interest, love and deep passion for what you are doing is the first step for producing something crap.

Ok, sometimes (or the majority of times) you will need to work on something that you don’t particularly like. Annoying clients, pretentious designers, a boss that doesn’t like you but pays your bills.

Even in these situations, will build bad code help you in some way?

The answer is simple. No. Not at all.

Use all the difficulties as a challenge to do your best. Use them to go beyond your limits. Building good code means improve day after day. If something it’s not challenging, challenge yourself in building something even better.

This is the only proven way to become a great developer (but this concept could be applied in the majority of jobs).

Build good code doesn’t necessary mean be the best developer in the world. There are all sort of good practices you can start using from day one:

  • Name everything in a way everyone can understand what it means
  • Use consistent styles for naming variables, functions, etc.
  • Keep the code clean and neat
  • Comment your code
  • Build appropriate documentation
  • Question yourself: can I make this in a simpler way?

“No one will see it” is not a good excuse

A couple of years ago I read Isaacson’s Steve Jobs’ Biography. That book was inspiring in so many ways that I could open a blog and chat just about that. At that time I was starting my journey in this world as a completely useless intern and one of that quotes changed my life forever.

“When you’re a carpenter making a beautiful chest of drawers, you’re not going to use a piece of plywood on the back, even though it faces the wall and nobody will ever see it. You’ll know it’s there, so you’re going to use a beautiful piece of wood in the back. For you to sleep well at night, the aesthetic, the quality, has to be carried all the way through.”

Steve Jobs put this philosophy into Apple products. Every detail had to be perfect. No matter if it was something that no one would notice.

With code is the same. Average people don’t read the code. They just surf the web, appreciate the overall design and enjoy the user experience.

Sorry to disappoint you. The fact that almost no one will see your work isn’t a good excuse. Never.

You should always do your very best to deliver an excellent product. And there are many reasons you should do it.

  • Pride. I can’t stand the sensation of not having done my best.
  • Aim for the perfection. The perfection might be impossible to achieve, but pushing towards it just forces me to improve my skills.
  • For the others. Writing great code will help other people if they will need to work on it. Nothing worse than work on someone else’s messy code.
  • Less bugs. This is not always true, but well written code is usually less error prone. Why spend hours and hours debugging?
  • Think at the next generation. Writing good code sets an example for the future generation of developers. People will see at the actual code trying to learn from it. Let’s teach them the power of beauty
  • Simple is beautiful. Simplicity is something that makes code beautiful. Keep a piece of code as clean as possible, without unnecessary complexities. This will make your software lighter and faster.
  • Good code as CV. If your code is beautiful, it will be more legible. People who happen to read your code and understand it will be more likely to do business with you.
  • Future. You never know what’s gonna happen in the future. If I will need to expand my software I want the code to be clear. This will avoid wasting hours understanding what I meant and less chance of compatibility problems with new modules.

Next time you will code. Clear your mind. Relax. You are starting a journey. Get into the zone, avoid distractions and start typing. That’s the first step for your personal masterpiece.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.