5 habits that prevent you from writing good code

  • Using obscure names for variables and functions

Most often it’s beginners who don’t see the need to bother with names – “Why, because I already understand and remember everything? And how long will you keep it all in your head? And most importantly, why? The code must be simple and understandable to all programmers who will work with it later. The first step to this is to give meaningful names to variables, functions and classes.

  • Not writing documentation

Most programmers do not like to bother with documentation. A common excuse is that code is the best documentation. But if the code needs to be revisited after several years and/or if the developer who worked with the code isn’t available, problems begin. New programmers can spend extra days, or even weeks, trying to figure out what was done, how, and why.

  • Quick solutions.

Hearing the task and immediately running to do it without understanding the nuances/not reading the requirements in full. Sometimes (always) you need to find out exactly what problem the client wants to solve, there are often simpler solutions to the problem.

Quick solutions are usually more cumbersome, less efficient and often lead to further fixes. The main work of a programmer is not to tinker with as many lines as possible, but to make the code as efficient as possible. To do this, one must first think everything over in one’s head and only then write.

  • Do more than necessary.

Some developers not only perform the task, but also “just in case” add something on top. Usually the programmer adds an extra piece of code on the assumption that it may be needed in the future. “Overengineering” doesn’t seem to be a bad habit, but it takes time (and thus money for the client) and leads to unnecessary complication of the code. In addition, the added piece of code may never be needed, so it is a waste of time.

  • Working without days off and no rest

You can work 7 days a week for 20 hours a day, but is it really worth it? How long can you maintain high efficiency at such a pace? Six to eight hours a day with obligatory breaks will give you more results. And also don’t forget about sports – when the body is toned and the brain works better. But that’s from the obvious.