Home > headlines > body text

An open question to explore: How can programmers improve their programming skills?

伊谢尔伦
Release: 2017-07-14 10:06:09
Original
1970 people have browsed it

How to improve programming skills? This question is largely an open question, and there may not yet be a unified answer in the IT industry. Everyone's learning and thinking styles are different, and the answers may be different in their minds. The following summarizes some of the more popular and popular views among individuals and web pages, provides some opinions and suggestions for programmers and developers, and helps friends on their journey to learn programming.

An open question to explore: How can programmers improve their programming skills?

1. Plan

At the beginning of programming, make a plan, draw up the design framework and Realize it. and repeat the operation. The best way to learn to code is by writing it. You will continue to learn and improve yourself through your mistakes. It is more motivating than reading a book and completing a project, and it will also bring you more fun. During the design phase, it is necessary to think about important details such as the relationships and interactions between modules and objects, control, and how data flows. If there are patterns or best practices available, use them. When designing a program, the ideas must be clear. First, the hierarchical structure must be clear, so that the relationship between the code blocks can be clarified, and the structure of the code blocks can be more reasonable. Doing something is usually broken down into multiple large steps, each large step can be broken down into multiple small steps, and the small steps can continue to be broken down. This structure is a hierarchical structure. It must be clear at which level the steps of the final code block belong. If this level is disrupted, the probability of bugs in the program is extremely high.

#2. Learn the basic programming language

##Learn basic programming languages ​​that can help you understand the underlying architecture. For example, C language, or assembly language.

Learning how computers execute programs and knowing how the operating system operates are the most basic requirements for programmers. If you want to have a good understanding of basic languages, you can read books about computer architecture, operating systems, embedded systems, driver operating system development, etc.

3. Write code

Practice writing code on your blog. You can also answer questions on different Q&A sites. At the same time you can also write some tutorials (DreamInCode). When you write code, you want to write it correctly so that you can explain the problems and techniques involved. Writing code can also reflect your programming knowledge and provide you with English grammar, which are very important in programming. Pay attention to code quality, don’t write code that looks messy, and don’t use names like asdf.

4. Join an open source project

What are the advantages of joining an open source project? You'll be able to work with others (who have worked alone on private projects) and when faced with unfamiliar code, you'll delve into it and learn to understand an unfamiliar code base (which should be quite challenging)

5. Learn how to read code

Some experts’ answers will mention reading more source code, and of course everyone will also list other For some content, reading source code is a very core method to improve programming ability, and programming ability itself is the core. When your programming skills improve, you will feel tingling when you read something wrong when reading the code. If the design

Module Design is not good, you will feel uncomfortable. Then debugging will naturally become much smoother. . .

What are the benefits of reading high-quality source code? This is very similar to the benefits of a lot of reading for writing. Writing code also has a sense of language. Before creating your own stuff, first read what others have created. Watch more how masters write code and try to understand what the masters are thinking when they write code. Over time, you will imitate and slowly learn how to write code like a master. When the amount of reading and writing reaches a certain level, many so-called design specifications and module processes in the industry will naturally be understood and followed, because this has become a habit.

6. Focus on thinking and testing

Before you start writing code, you need to think about it first, organize your ideas, take out paper and pen, and carefully come up with a plan. Relax your brain and keep your mind clear. Various error situations must be considered from the beginning, such as I/O errors, external module errors, user misoperations, etc. First of all, from the perspective of the possible occurrence of bugs, the more complex the project, the more bugs will be generated, and the actual situation is that the relationship between the two is non-linear. So you must be afraid of the complexity of the code. Bugs will obviously be easier to debug for short codes. A very important task is to conduct unit testing. For each single function, module, program, etc., test it in turn. To generate a set of data within a range to ensure that each function, module, and program can return correct results under any circumstances.

Another important significance of testing is to prevent overlapping bugs. A program has multiple bugs. When they exist together in your program, they have strange interactions with each other, causing errors to occur only with certain data. And when you adjust one of them, all your data will be wrong. You will subconsciously think that there is something wrong with your previous repair. Although this situation sounds ridiculous, in fact, this problem is often encountered.

In addition to unit testing, a very important skill is to encapsulate and re-encapsulate. Encapsulate everything that may need to be called repeatedly into interfaces, abstract classes, methods or functions. The benefits of this are self-evident. Once something goes wrong, all the code can be modified at once. Moreover, when debugging the program, the code is very short, so it is easy to determine which part is causing the problem.

7. Read good programming books

You will learn a lot from books. Although practice is important, by reading good programming books And challenging programming books are an important step in changing your way of thinking. Of course, you can choose some less difficult books, but avoid choosing those "dumb" books, that is, books that can teach you everything in 24 hours or 21 days. There is no way to learn to improve your programming skills from these books.

8. Try to solve some difficult problems

You should try to solve code problems; programmers always try to use the least amount of time during programming. Step by step to solve the difficult problems encountered, and in the process, you can learn the more profound and special functions of the language, so that you will have to think creatively about the code.

9. Some other important things

1) Prepare unit test cases (preferably (Writing unit test cases while writing code), and then continuously improving the unit test case set based on feedback from system joint debugging and production environment. After a few iterations, the modules covered by unit tests will maintain fairly good performance, and you can refactor those modules with confidence.

2) Before you start writing code, write documentation first. Especially if more than one person in the project writes code, documentation is even more important. It can help you clarify your thinking and discover some logic pitfalls in advance. Comments are to guard against "gentlemen" rather than "villains". You need to be on guard against callers who do not follow the rules. Therefore, it is also important to ensure that the required prerequisites have been met through assertions (or inspection judgments). In addition, whether your own code block achieves the expected purpose after execution can also be judged through assertions or check logic. In this regard, some ideas and practices of contract programming can be used for reference. Many times, program bugs occur because some internal implicit conditions are not met, which is more reflected in the fact that the caller does not know what the callee requires of him. Therefore, don't be stingy with comments. Expressing these requirements clearly through standardized comments will significantly reduce bugs.

3) When writing secondary logs to log files, use the popular log class instead of the simple printf. It is best to write important logs in data tables, so that you can use the functions of SQL and database software to manage, analyze, and use these log data.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!