Home  >  Article  >  How to learn to be a good programmer

How to learn to be a good programmer

silencement
silencementOriginal
2019-06-13 11:14:451774browse

How to learn to be a good programmer

As a software programmer in the IT industry, what motivates me to go to work every day is the fun and passion for programming. But to spark fun and gain everlasting thrill, we need to learn and follow some basics to become a good programmer.

Of course, the things I summarized are not that amazing. If you say that you will definitely become an excellent programmer after learning them, that is impossible. These are just some shortcuts based on my experience. The definition of an excellent programmer can be understood here as a programmer who can develop excellent IT solutions and promote the overall development of the industry.

1. Master the basic knowledge

Regardless of any industry and any job, understanding of concepts is the key to success. It's impossible to become a good programmer unless you have a strong conceptual foundation. Understanding core concepts helps you design and implement solutions in the best possible way. If you feel that you don't have a good grasp of certain concepts about core computer science and programming languages, it's not too late to go back and relearn the basics.

2. Label each code set you write (how, what)

I found that there is a clear distinction between good and bad programmers. The key is whether you have the passion to know "what and how". Some programmers know exactly how their code is executed and the results of the execution. I also understand that sometimes because of time constraints, we have to move on to the next step immediately when we just know that the code will get the job done. Although this may seem like a topic in another direction when it comes to problem solving, as a programmer we should delve into the problem as deeply as possible to reach the highest level. Trust me, as time goes by, you will develop this good habit without even realizing it, and the benefits will be endless. .

3. Learn more by helping others

Maybe most of us only go to forums and groups when we need help. One dividing line that distinguishes good programmers from good ones is that good ones often go to these places to help others. And while they are helping others, they can also learn a lot themselves. If you are in a team, you should also help each other. Trust me, understanding the context of other people's problems, researching and proposing solutions will help you learn more and grow faster.

4. Code should be written in a simple, understandable, and logical manner

Just like in other aspects of life, the KISS (Keep it simple and short) rule also applies in the field of programming. The code should be logical and avoid being too complex. The reason why some people want to write so complicated code is just to prove that they have the ability to write complex code. But my experience tells me that simple and logical code can work effectively, have fewer problems and be easier to expand. I remember there is such a saying

Good code itself is the best document. 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 the problem, and you can do it later. Spend less time fixing

and spend more time understanding and analyzing the problem, designing the optimal solution, and then you will find that the next work will be more effective with half the effort. The design process does not necessarily mean using modeling languages ​​and tools, it can be as simple as looking up at the sky and brainstorming in your head. Programmers who habitually write code as soon as they get a problem will often end up with different results than what was required.

If you don’t have the overall structure of the program in your mind when you take a shower, it means you are not ready to start writing code. ——Richard Pattis

6. Be the first to analyze and review your own code

Although it is a bit difficult, you can know the problem before others find it. Let you learn how to write "nearly bug-free" code. You must be fair and rigorous in your own code reviews, and you must be able to accept reviews from others without hesitation. Close to the best, working with good programmers and actively listening to their feedback will definitely help you become a good programmer.

7. Don’t be discouraged by the ever-changing technology

In recent times, many people I have met in the IT industry - either complaining about being disappointed with their jobs, or even quitting their jobs and looking for new jobs - have unanimously stated that they want to learn and Use the latest technology. I think this wish is understandable, but I don't think the word "latest" is quite correct. Every day we hear people saying "What new tools, APIs, frameworks and other methods are coming out now" that can make programming easier. This actually happens all the time in the technology field. What we really need to pay attention to and understand is the transformation of core and basic technologies, and then look at new frameworks, tools and APIs on this basis. For example, many Java companies may change to a new web framework every other week, but its demand method is based on the client-server communication model, MVC model, filters/servlets/JSP, resource binding, and XML parsing. The core concepts remain the same. So, instead of constantly worrying about changes in frameworks and tools, take the time to learn these core concepts. 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 for a long time

Many times, software programmers may adopt emergency and workaround solutions (either because of time constraints or lack of understanding) In-depth understanding of the problem, or insufficient technical experience). However, these workarounds break the code, making it difficult to extend and maintain later. I can understand that sometimes this situation is really difficult to avoid, but just like we should all tell the truth, if you tell a lie, you have to know that the lie will be exposed one day.

9. Read documents

One of the basic habits of good programmers is to read a large number of documents, technical indicators, JSR, API documents, tutorials, etc. Reading documentation provides the necessary foundation for programming in the best possible way.

10. Learn other people’s code

I really like to communicate and interact with those excellent programmers who have java source code in the IDE, and read/reference their code. Because by doing so, you can not only understand the basic knowledge, but also learn new ways to write projects. Reading and referring to some reliable and known open source code or your own advanced code will also help us program better.

The above is the detailed content of How to learn to be a good programmer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn