
A good programmer is someone who always looks both ways before crossing a one-way street. — Doug Linder
As a software programmer in the IT industry, the thing that drives me to work every day is the joy and passion for programming. But to stimulate that joy and gain lasting satisfaction, we need to learn and follow some fundamentals to become an excellent programmer.
Of course, what I've summarized here isn't magical. If you think you can definitely become an excellent programmer just by learning these, that's impossible. These are just some shortcuts from my experience. The definition of an excellent programmer here can be understood as someone who can develop great IT solutions and promote the overall development of the industry.
1. Master the Basics
No matter the industry or job, understanding concepts is key to success. Unless you have a strong conceptual foundation, it's impossible to become an excellent programmer. Understanding core concepts helps you design and implement solutions in the best way. If you feel you haven't properly mastered the specific concepts of core computer science and programming languages, it's not too late to go back and relearn these basics.
2. Label Every Code Set You Write (How, What)
I've found that an obvious dividing line between good and bad programmers is whether there's a passion to know "what and how." Some programmers know clearly how their code executes and what the results are. I also understand that sometimes due to time constraints, we have to move on to the next step knowing only that the code can get the job done. Although this seems like a topic in another direction for problem-solving, as programmers, we should research problems as deeply as possible to reach the highest level. Believe me, over time, you will unconsciously develop this good habit and benefit enormously from it.
3. Learn More by Helping Others
Most of us might only go to forums and groups when we need help ourselves. One line that distinguishes whether a programmer is excellent is that excellent ones often go to these places to help others. And while helping others, they also learn a lot themselves. If you're on a team, you should also help each other. Believe me, understanding others' problem contexts, researching, and proposing solutions will help you learn more and grow faster.
4. Write Code That Is Simple, Understandable, and Logical
As in other aspects of life, the KISS (Keep It Simple and Short) rule applies to programming. Code should be logical and avoid being overly complex. Some people write code so complex just to prove they have the ability to write complex code. But my experience tells me that simple and logical code works effectively, has fewer problems, and is easier to extend. I remember a saying:
Good code is itself the best documentation. Before you add a comment, ask yourself, "How can I improve the code so that I don't need to write this comment?" — Steve McConnell
5. Spend More Time Analyzing Problems, So You Spend Less Time Fixing Them Later
Spend more time understanding and analyzing problems, design the optimal solution, and then you'll find the rest of the work will be twice as effective with half the effort. The design process doesn't necessarily mean using modeling languages and tools; it can also be simple, like looking up at the sky and having a brainstorming session in your head. Programmers who habitually start typing code the moment they get a problem often end up with results that differ from what was required.
If you don't have the overall structure of the program in your head even when you're taking a shower, it means you're not ready to start writing code. — Richard Pattis
6. Be the First to Analyze and Review Your Own Code
Although it's a bit difficult, knowing the problems yourself before others discover them can help you learn how to write code that's "close to bug-free." Your own code reviews should be fair and rigorous, and you should also accept others' reviews without hesitation. As the saying goes, "those who stay near vermilion become red" — working with excellent programmers and actively listening to their feedback will certainly help you become an excellent programmer too.
7. Don't Be Discouraged by Ever-Changing Technology
Recently in the IT industry, many people I've met — either complaining about being disappointed with their jobs, or even having already quit and looking for new jobs — all consistently said that they want to learn and use the latest technology. I think this wish is understandable, but the word "latest" — I don't think it's quite right. Every day we hear people saying "there are now new tools, APIs, frameworks, and other methods" that can make programming work simpler. This has always been happening in the technology field. What really needs our attention and understanding is the shift in core and fundamental technologies, and on that basis, look at new frameworks, tools, and APIs. For example, many Java companies might switch to new web frameworks every other week, but the core concepts — the request method based on the client-server communication pattern, the MVC pattern, filters/servlets/JSP, resource binding, XML parsing, etc. — remain the same. So, instead of constantly worrying about changes in frameworks and tools, it's better to spend time learning these core concepts well. Believe me, on the basis of understanding these core concepts, we can master new frameworks, tools, and APIs faster.
8. Emergency Measures Are Not Effective in the Long Run
Many times, software programmers may adopt emergency and workaround solutions (whether due to time pressure, lack of deep understanding of the problem, or insufficient technical experience). But these emergency solutions will damage the code, making it difficult to extend and maintain later. I can understand that sometimes this situation is really hard to avoid, but just as we should all tell the truth, if you tell a lie, you have to know that lies will eventually be exposed.
9. Read Documentation
One of the basic habits of excellent programmers is reading a lot of documentation — technical specifications, JSRs, API docs, tutorials, and so on. Reading documentation lays the necessary foundation for us to program in the best way.
10. Learn from Others' Code
I really enjoy interacting with excellent programmers who have Java source code in their IDEs, and reading/referencing their code. Because doing this not only helps understand the basics, but also teaches new ways to write projects. Reading and referencing reliable and well-known open source code, or your own advanced code, also helps us program better.
One Last Point That Wasn't Listed Above: Don't Compare Yourself with Others
As the saying goes, comparing yourself with others only makes you miserable. Comparing yourself with others only leads to negative emotions and turns into unhealthy competition. Everyone has their own strengths and weaknesses. I've seen many times so-called "super awesome" programmers make really stupid mistakes. So, analyze yourself, list your shortcomings, and work hard to improve yourself — that's the right path.
Programming is a real joy, and you're welcome to enjoy it.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." — Martin Fowler
Translation link: http://www.codeceo.com/article/10-effective-way-good-programmer.html
Translator: Codeceo – Xiao Feng