A good programmer is someone who looks at both sides when crossing a one-way street.
As a software programmer in the IT industry, what drives our hard work day after day is our interest and passion for programming. But to make programming always interesting, we must learn to adhere to certain basic principles of being a good programmer.
I'm not going to write some spells, you can become a good programmer by following them. My purpose is to record some useful experiences that I have learned and used, and they help me get better results. There is no clear definition of good programmers. Here we refer to those who have created excellent IT solutions and helped the industry grow.
![Ten effective ways to become a good programmer, some things on the Internet](http://www.yixieshi.com/uploads/allimg/130909/011AV236-0.jpg)
0. Master the basics
For any job in any industry, integration is the key to success. A person must have a solid foundation if he wants to be a good programmer. The understanding of the core concept will help you design and implement the most perfect solution in the best way. If you feel that you cannot master the core computer science or the knowledge of a certain programming language, it is not too late to start reviewing the basics now. ( For knowledge points that you don’t understand at work, check them out as soon as you have time. If you still don’t understand, communicate with others and ask them for advice. )
1. Start labeling the code you have written (how to do, what to do)
I found that there is a clear dividing line between good programmers and ordinary programmers. Good programmers are eager to delve into what each line of code does and how to achieve it. There is such a small group of people, they must understand every line of code. I know that if time is very tight, we often fail to follow this principle and just write some code and know that it achieves the required functions. How to deal with this situation is another topic, but as a programmer, we often have to explore as deeply as possible. Believe me, this will become a habit over time, and you will do it every time you don't know it. ( When time is not tight, learn this good habit and think about what each line of code does. )
2. Help others, you can learn more
Many people have a common feature. Only when they need help, he will turn to forums or groups. The difference between good programmers is that they often browse forums to help others. Compared to relying on others to help solve problems, they help others to learn more. It is the same in a team, helping others solve problems and gaining more. Trust me, understand other people’s problems, think about it and finally provide solutions, you will learn more than before. ( Yes )
3. Write easy-to-understand, logical code
Just as the KISS principle (keep short and sharp) applies to all aspects of life, it also applies to programming. Try to write logical code to avoid complications. Sometimes people write complex code just to show that they are capable of writing such code. My experience tells me that simple and logical code is very good, will cause fewer problems, and is easier to extend. I remember a sentence:
Good code is the best documentation in itself. When you want to add comments, ask yourself, "How can I improve my code so that I can read it without commenting?"
( Try to do it this way )
4. Spend more time analyzing the problem, and you will spend less time solving the problem
Spend more time understanding and analyzing the problem, and then design a plan. You will find that the rest is easy. Design is not about using modeling language and tools, but just looking at the sky and conceiving in your head. Those who start coding as soon as they encounter problems often end up deviating from requirements.
如果你洗澡的时候不能理清整个程序的结构,那么你还没准备好开始编程。 – Richard Pattis
(深有体会,一上来就写,往往写着写着就又开始想了,有可能还要重新写,试着养成花更多时间分析问题的习惯。)
5. 成为第一个检查你的代码的人
虽然有一点点难,但试着在其他人修改你代码之前修改它,随着时间的推移,你会写出几乎没有bug的代码。对你的代码做没有任何偏见的检查,也不要犹豫让其他人来检查你的代码。和其他优秀的程序员一起工作,接受他们的意见能够帮助你也成长为一个优秀的程序员。(养成这种检查的意识)
6. 不要迷失在快速更迭的科技世界
在IT行业中,我经常遇见许多人,他们对现在的工作不满,甚至离开它去追寻新的工作,理由是因为他们想要学习最新的科技。我们每天听到的都是新工具、接口、框架,能让程序更简单,速度更快。这在科技世界中司空见惯并会一直如此。但是最基本的最核心的科技变化比那些框架、工具和接口的变化小得多。就像大海,大海表面上波涛翻滚,但大海深处却相当平静,而那里才是水生生物生存的地方。所以将你自己置身于核心技术的大海深处吧。举个例子,在Java企业级应用中,每个星期都会出现新的框架,但是核心的技术是不变的,譬如基于客户端-服务器端的请求,MVS模式,filters/servlets/JSP,数据源绑定,XML解析等等。所以要花功夫去学习核心概念,而不是去担忧日新月异的框架和工具的出现。相信我,有了核心技术的基础,你会发现学习新的框架,工具以及接口变得更容易了。(核!心!技!术!,一个前辈说过,新技术层出不穷,但是背后的原理都是相通的。)
7. 应急方案不会持续很长时间
Many times software engineers will adopt contingency plans (maybe due to lack of time, incomplete understanding of the problem or lack of experience). But this often results in messy code, lack of scalability and maintainability, and later wasted more time. Please start implementation after you understand the whole plan. I know that there are situations where emergency solutions are inevitable, as if one should tell the truth, but in some cases you have to lie. ( I have this consciousness in my heart )
8. Read the documentation
Reading a lot of documents is one of the necessary habit of being a good programmer. It may be a product specification, JSR, API document, tutorial, etc. Reading the documentation helps you gain the necessary basic knowledge and write better code. ( Develop this habit )
9. You can learn other people's code
I have been in contact with some excellent programmers. They keep JAVA source code in the IDE, and they often read and consult in their daily work. They did this not only to satisfy the thirst for knowledge, but also to learn how to write excellent programs. Read and consult the well-known open source code that you think is reliable or the code of programmers who are more senior than you, and you will write better programs. (Extended reading: "Reading excellent code is a shortcut to improve the cultivation of developers") ( Cultivate this habit )
Finally, what I want to say but did not list it above: Don’t compare with others
Comparing with others often leads to negative emotions and unhealthy competition. Everyone has his strengths and weaknesses. It is very important to exploit strengths and avoid weaknesses. I also often see some very low-level mistakes made by programmers who are very basic. So just compare with yourself, list the areas you need to improve, and continue to improve it. Programming is a very interesting thing, enjoy it. (I remember one said that true excellence is better than yourself in the past. Seeing the author's words above, I suddenly became clear, and I tried my best to learn from other people's good places. )
Any fool can write a program that a computer can understand, but a good programmer can write a program that others can understand.