The cultivation road of old code farmers: these 7 necessary stages that you have to know

The cultivation road of old code farmers: these 7 necessary stages that you have to know

Data structures, algorithms, and design patterns are considered to be the three essential internal skills for programmers. What is your understanding of design patterns? When did you realize that you need to learn design patterns? This article will share some of the author s years of programming Thinking and experience, as well as some suggestions on how to improve design ability.

After I finished the design-related training and sharing, some classmates came to me and asked me: How can I quickly improve my design ability? I think this question is very representative and represents the aspirations of a large group of programmers on the arduous road of cultivation. Now I will share my thoughts and experience on this issue for your reference. Different opinions and opinions are also welcome to discuss together.

A coding experience

Code line experience is a very important thing. When you don t have 10,000 lines of code experience, you can ask how to improve your design ability. I can only tell you not to be too entangled. Just look at the theory and write honestly. Code it.

It is said that the average code speed of a programmer is 200~300 lines per day. You might say, why should I write 1,000 lines a day? Don t forget, after you ve coded the code, you still need to test and debug. , Optimization, BUG Fix, you can't keep coding at these times.

I won t say much about the coding standards. If your code is still messy, don t talk about the design and architecture. I think it s a bit nonsense.

In addition, as a code cleanliness patient, it is recommended that you do not format the code in batches after writing the code, or organize the code manually, but every time you type a character, it is in compliance with the specification. Habits are really important. Sometimes during a recruitment interview, I really want to add a link to write a program on-site to complete a simple but error-prone task.

Two theoretical learning

Simply put, it means reading books and blogs. The resources you can get are of high quality. For example: "Refactoring-Improving the Design of Existing Code", "Agile Software Development: Principles, Patterns and Practices", "UML and Pattern Application", "Object-Oriented Design Principles" (5.Principles), "Design Patterns", etc.

The book "Design Patterns" is a very old book, only 200 pages short, but this is the most difficult to understand book, you may not be able to finish it in a month (if you read a novel, 3 pages of 200 pages Maybe I'll finish it in a few hours), and even if I finish it, I won't understand it all, it's probably not more than 30%. It doesn't matter if you don't understand it, just read it, don't be too entangled, this doesn't explain the problem.

In addition, I want to say that multi-threading technology must be mastered by programmers and needs to be understood thoroughly. Current advanced technologies such as GCD will cover up your insufficient understanding of multi-threading because it is so easy to use. Not to mention that you have completed a complex project without writing too many threads, not to mention that the multi-threaded code you hand-written does not seem to have any problems, give me your code, and I will write a Demo to make it go wrong or even crash , If I can't do it, congratulations.

3.practices

Now that you have a certain amount of coding experience, and have learned enough theoretical knowledge, the next step is the time to practice hands. Think carefully about how to apply the theoretical knowledge you have learned to the project, and practice it personally. You must clarify those theories and use them to guide your practice, put away your previous self-confidence, and first deny your previous practices. , To ensure that what is made each time is improved and improved compared to before.

Four-Review Theory

You can already see your progress and find that you are doing better than before, but you always feel that it is not enough, as if there is a bottleneck. Congratulations, I can already see your future potential.

Pick up the book again and revisit the things that seemed to be understandable before. You will find the things that you didn't understand before. Now they are suddenly enlightened, and they are no longer the obscurity that is difficult to understand. Even if you think you have understood it before, read it again, and there will usually be new gains.

5.practice

At this stage, you have already mastered a lot of things. Not only are you rich in practical experience, you can also master various theories, but you find that your design is still not professional enough. And if you look back at the code you wrote before, you will be surprised: Oh my God, who wrote this code, how can you do it like this! Then. . . I won't say much. You have entered the stage of introspection, and you have mastered the learning method that suits you. It is no longer a matter to learn anything new.

6.summary

Don't be too proud (don't believe it? Then you go to give a lecture to see), you need to summarize, summarize your own learning methods, summarize project experience, summarize design theory knowledge.

If you can have your own unique understanding, instead of just using mature design patterns or something, you can sum up some design principles based on your own experience and lessons, then it is naturally excellent.

7.shares

Sharing is the best catalyst for learning. When you are preparing for a training sharing session, you will find that what you thought you had understood is not really understood, because you can t explain it clearly. In fact, it s just not enough research. At this time, you will be forced to study in depth again, and then you will dare to step onto the stage. Otherwise, when others ask questions, you will not be able to answer them at all.

The above is what I think is the necessary stage of the programmer's cultivation path.

Then, let me talk about other points that are very important for improvement:

Get in the habit of designing first, then coding

Almost all programmers are reluctant to write documents at the beginning, and they are reluctant to design carefully. They can't help the restless hands when they get their needs. They always feel that they are typing on the keyboard and line by line of code pops out , To have a sense of accomplishment, is the correct working posture.

Don't code without discussing it clearly, otherwise you will definitely rework.

Design is more important than coding, interface is more important than implementation

The process of formulating an interface is itself a design process. The interface must be repeatedly scrutinized, and try to do subtraction instead of addition. The simpler the better if it can meet the needs.

In addition, don't think about it alone, first simply make a prototype, and then use it to communicate with the user until the other party is satisfied.

Don't design interfaces completely based on usage requirements. Refer to MVVM. ViewModel repackages the Model according to the needs of the View. These interfaces cannot be directly designed into the Model.

Do not follow design patterns blindly

Design patterns are just a way to solve problems. You can also have your own methods. Of course, if you use design patterns well, your design will look professional and elegant. After all, the brainchild of the predecessors. But abuse can also cause more serious problems, and may even become a disaster. I personally feel that object-oriented design principles are more important. Some principles must be followed (such as one-way dependency, SRP, etc.), and the design patterns themselves follow these principles, and some patterns are designed to follow certain principles.

Abstraction is not omnipotent, and it needs careful scrutiny to use it in the right place. When there is a better solution that can solve the problem without abstraction, try to avoid abstraction. I have seen too many cases where abstraction is over-designed, which adds too much maintenance cost. It is better to write in the most natural way.

Empty cup mentality, learn from the classmates around you, stand on the shoulders of giants, stand on the shoulders of others

If someone makes an opinion, accept it first (regardless of whether you accept it or not).

Many programmers also have a problem, that is, they feel that they are technically inadequate, and are unwilling to accept other people's opinions, especially negative opinions (literati are weaker).

Whether it is theoretical study or coding practice, learning from the students around you will have the greatest impact on you (three persons, there must be my teacher), and it is more useful than deliberately participating in relevant training.

I myself often benefit from discussions with my classmates on the team. When I am puzzled, I throw out the problem and discuss it, and I usually get the best solution.

In addition, there is another advantage of discussing with other people in the team, that is, when your design is compromised and some are unprofessional, others will not question the code when they see the code, because he participated in the discussion, you don't need to spend so much time to Explain.

During the design period, I must find others to discuss it. I have always opposed a person who finishes the design and writes the document, and then finds the model of everyone to hold a review meeting. Although it has an effect, the effect is really not the ultimate. Everyone did not participate in the design. The time understanding through a meeting may not be so deep. The most important thing is that if there are some problems in the design, but it is not a fatal problem, should it be redesigned?

After the preliminary discussion is enough, everyone knows your ideas and plans, and there are also design documents at the end. When other people come to read your code, you don t need any guidance at all, and future work transfers will not be necessary. He Le Instead of doing it?

Finally, I would like to appeal here. When you are going to modify and maintain someone else s code, it is best to find the person in charge of the module for in-depth discussion and communication, so that he understands your needs and your plan, and ask him to help evaluate whether the plan is feasible. Whether it will step on the pit, bury it, etc. In this way, our project will not spread bad smell, and if you happen to be the person in charge of a certain module, please exercise your authority and refuse to submit the problematic code that does not meet the requirements into the library.

Everyone encourages.

Finally, the editor sorted out a lot of java advanced learning materials and BAT interviews for you who love the IT industry. If you need information, please forward this article and then chat privately. The editor will reply [java] to receive the advanced java learning in 2019. Information and BAT interview questions and the electronic book of "Effective Java" (3rd edition). You can also join the group: 712263501 to receive massive learning materials for learning.