Why good code matters a lot?
Nithyanandam Venu
Front-End Architect | JavaScript & React Expert | AI Enthusiast | Digital Marketing |Built Multiple Enterprise Grade Products Over a Decade
Being a programmer we all have been in a stage of writing messy code. I still do write messy code and at times without even realizing it. It nearly took me a year to understand, why good code plays a tremendous part in the development.
At the initial stages, whenever I get some requirements, I just jump straight into the code mindlessly without thinking too much about separating, maintaining and organizing it. I would only have thought about converting the requirement into a working product/feature.
This made me finish my work sooner but when it comes to fixing a bug or adding a new feature on top of the product/feature that i had already done always took a good amount of time than it should actually take. This is totally because of the way I wrote the code without keeping it modular, maintainable and organized.
After I realized this, It had totally changed my perception of writing a code and about being a developer. A good developer is not the one who writes a lot of code and finish of the requirement soon but the one who thinks more and write less code. This reminds me of the article I read in the past which says "The Best Code is No Code At All".
Yes, if you keep reading that, it will make you realize the wonderful meaning behind it. No one can make a 100% bug-free code. It's not possible.There may be a few edge case you miss out, may be a few variable mistakes. The best codes are always the number of lines of code that has been unwritten.
This gave me a simple lesson to keep my code simple. The lesser you make your code, the lesser the bug you have to handle. Me once been into this greatness of good code phase, I had been trying to change the way I code from there on.
The first thing I started doing was, whenever the requirement has given I started spending a lot of time thinking about organizing and separating the functionalities together. I almost analyze it and make a clear map in my mind how my code will be organized and interact together and avoided more redundant code.
When I started coding, I made sure of giving proper comments to function and maintaining proper variable names to make my life easy as well as the guy who may take over my code in future. I started writing libraries instead of dumping all the functionalities in a single file like I used to do before. I started to try writing a better code, even though it took time. I have always tried to think in two or three ways to implement a function before actually writing it. I ended up with the simple and efficient one from my choices in my code.
Good code is like a good joke. it needs no explanation
It's a great feeling to write a good code. A good code makes up a good developer.Even though the transformation phase is kind of not a smoother one, it's totally worth it. The amount of pleasure you get after writing an awesome snippet of elegant code with proper comments is totally priceless.
While I still try my best to write better code I still end up writing messy code at times because of various factors. But I had kept my goal clear and trying to reach it out with step by step progress.
I have written this article to make it clear that how important to write a good code. I will surely write a follow-up article about what are all the coding convention standards and transformation I went through in my coding style.
Coding is like a art once you realise it you will be the greatest creator of it.
Don't forget to check this out
https://dobsondev.com/2014/07/04/think-more-code-less/
Image source: Google