You can ask 100 different people what any programmer should know and be able to do, and get 100 different answers. This can be both overwhelming and frightening. All advice is good, all principles are sound, all stories are convincing, but where to start? And, more importantly, once you start applying best practices, how do you maintain the right level and make them an integral part of your programming practice?
I think the answer lies in your mindset or simply in your approach. If you are indifferent to your fellow developers, testers, managers, sales and marketing staff, as well as end users, you will not feel the urge to, for example, conduct test-driven development or write clear comments in the code. I think there is a simple way to change your attitude and develop a desire to release products of the highest quality:
Write code as if you will be maintaining it for the rest of your life.
That’s it. If you accept this idea, amazing things will start to happen. Agreeing that any of your former or current employers has the right to call you in the middle of the night and ask you to explain (of course, if you parted on good terms) the reasoning behind the decisions you made when writing a certain getValue() method, you will begin your journey to mastery in programming. You will want to come up with better names for variables and methods yourself. You will try not to allow, so that code blocks consist of hundreds of lines. You will search for, study, and apply design patterns. You will start writing comments, testing code and continuously refactor it. Maintain all the code you have written for the rest of your life? This task will become more and more grandiose. You will simply have no choice but to work better, more inventively, and more efficiently.
If you think about it, the code you wrote many years ago continues to impact your career, whether you like it or not. Every method, class, or module that you designed or wrote carries the imprint of your knowledge, attitude towards work, perseverance, professionalism, level of engagement, and degree of enjoyment. People form their opinions about you based on the code they see. If this opinion is consistently negative, your career will not progress as quickly as you would like. Every line of your code should benefit your career, your clients, and your users – write code as if you had to maintain it for the rest of your life.