Whether you are working for a big software company or a small sized startup, writing good code is pretty much critical to your success. But the catch is it is not very easy to achieve without proper motivation from your side.
I have been coding professionally for almost 4 years now. First, two years were as a freelancer and I mostly followed Get Things Done mode during that time. It was okay then because it was mostly a one time gig and once done you didn’t have to do anything with it. Though I never wrote really bad code even at that time the amount of maturity and knowledge required to write code that is maintainable, DRY and has some documentation was clearly not there.
While I joined my first company back in 2013, I really struggled against my bad habits. I was able to solve tough technical problems as problem-solving is always close to my heart but there were serious issues with my code quality. Sometimes there was some indentation issue and something there was some code repetition. I was lucky to have my Mentor “Ruben” to closely look at my code and review it sharply and give his most honest feedback. Upon pondering about the review I realized most of the issues were coming because a certain amount of thinking and carefulness that was missing from my workflow. I didn’t have my editor configured properly. A mix of tabs and spaces will obviously come back to bite you and code will look ugly on the browser even though it looked fine on your editor. (Sublime Text, I am looking at you).
Now, after almost a year later I am an improved and mature programmer than what I was at this point of time last year. So what changed?
Here is a short summary of things I did in order to get better at writing code:
Read the f**king documentation - This is kind of most important if you want to really use the power the language or the framework provides. Otherwise, you will keep writing shitty code because you were never aware better way exists.