You don’t need to be Sherlock Holmes to understand that good programmers write good code. Well, the bad ones don’t. They create ugly things that everyone else has to clean up. But you want to write good code, right? Then you need to strive to become a good programmer.
Good code doesn’t just appear out of nowhere. Its emergence is not caused by the favorable alignment of the planets. To make the code good, you need to work on it, and quite a bit. You will create good code only when you truly strive for it. Good programming is not the result of mere technical competence. I have encountered very smart programmers who are capable of creating strong and impressive algorithms, know the standards of their language perfectly, and yet write completely terrible code. It is difficult to read, difficult to work with, and difficult to modify. I have also encountered programmers with more modest abilities who lean towards very simple code but write elegant and expressive programs, which are a pleasure to work with.
Experience in the software development industry has led me to the conclusion that, in practice, the difference between merely competent programmers and outstanding programmers lies in one thing: their attitude towards work. Good programming requires a professional approach and a desire to write the best possible code, taking into account the constraints imposed by the surrounding reality and industry requirements.
The road to hell is paved with good intentions. To become an excellent programmer, one must abandon good intentions and truly care about the code—cultivating a positive outlook on writing code and developing a healthy attitude towards work. Outstanding code is the result of meticulous efforts by skilled artisans, not a haphazard creation by a programmer or a mysterious product of self-proclaimed coding gurus.
You want to write good code. You want to be a good programmer. Then you should strive for the following:
-Whatever the working conditions may be, you refuse to hastily write code that supposedly solves the problem. You strive to write beautiful code whose correctness is evident (and proven by well-written tests).
- You write code that is understandable (other programmers can quickly figure it out and continue working), easy to maintain (you or other programmers can easily modify it in the future), and correct (you have done everything possible to show that you have truly solved the problem, rather than just creating the appearance of a working program).
- You get along well with other programmers. A programmer shouldn’t be a recluse. Rarely does a programmer work alone: most work as part of a team of programmers, whether within a company or on an open-source project. You take into account the characteristics of other programmers and write code so that they can read it. You strive to help the team create the best possible product, rather than to show how smart you are.
- When you get your hands on some code, you try to make it a little better after you (better organized, better tested, more understandable…).
- You love code and programming, so you constantly study new languages, idioms, and new techniques. But you only apply them when appropriate.
Fortunately, you are reading these tips because you truly love coding. You find it interesting. This is your hobby. Enjoy programming. Rejoice in writing code to solve a complex problem. Write programs that you can be proud of.