“My code is working well, the website I built is looking great, and my client is happy. So why would I still care about writing clean code?”
If this sounds like you, then read on.
A little while ago, I was having a discussion with one of my friends, Kabir. Kabir is an experienced programmer. He was working on a complex project, and he was discussing a problem with me. When I asked to see the code for that problem, he said, sounding proud, “I built this project so we are the only ones who can understand the code.”
I was pretty horrified. I asked him if he deliberately wrote dirty code.
“The client didn’t give me enough time,” my friend told me. “He is always in a hurry and pushing for deliveries, so I did not have time to think about cleaning it up.”
This is almost always the excuse I hear when I ask about dirty code.
Some programmers write dirty code because they plan to release the first working version and then work to make it clean. But it does not work; no client gives you time to clean code. Once the first version is released, they will push you for the second. So, make it a habit to write code as clean as you can from the first line of code.
I’ve always learned that using clean code principles has many benefits down the line, and this post will show you why.
It is the job of the project manager, sales head, or client to get the project done in minimum time so they can control the cost of the project. But producing quality, clean code is your duty as the programmer.
Writing clean code is not a big or time-consuming task, but making it your routine, and committing to it, will go a long way toward advancing your career and improving your own time management.
Clean code always looks like it was written by someone who cares.
Benefits of Clean Code
“Why should I care about writing clean code?” you may still be asking yourself.
There are many reasons to get into the clean code mindset I described above. Some of the most important reasons are:
- Better Use of Your Time
- Easier Onboarding for New Team Members
- Easier Debugging
- More Efficient