First, we all know the importance of design experience. How many times have you been have to have this feel: You have already solved a problem but isn't it clear to know where or how to solve it? If you can remember the details of the previous problem and how to solve it, you can multiplex the previous experience without re-discovered it. However, we don't have a good record of software design experience that can be used by others. How to record the design experience of object-oriented software? Design Mode The emergence of this concept enables us to grasp the theoretical system from thinking. The design pattern makes people more easily and easily reuse successful design and architecture. It will also make new system developers easier to understand their design ideas.
Second, what is the design pattern? GOF describes the mode in the "Design Mode" book as: Solving a certain issue in a certain environment, including three basic elements - issues, solutions, and environments. At the same time, a template for a record mode is proposed. Interested readers can read the book (strongly recommended that beginners as the number of entrances). However, in the case of my personal simplistic habit, the most common and most meaningful is: intent, motivation and applicable. These three aspects are well described in the actual start, first of all, in order to solve any problems, how is the problem to solve the problem, and finally the practical practicality. Here I am a suggestion of how to learn design mode: 1) Familiar with C readers, you can refer to GOF's "design model" book, the book can be said to be the nasal ancestors of design pattern textbooks, many textbooks are referred to this book. It is a must-read for entry. Familiar with Java can refer to another book: James W. Cooper's Design Patterns, which seems to have no Chinese version. 2) Second, in the learning process, we must start with the environment from the solution, because the design model is mainly for solutions. Only in the specific example, the specific design pattern has the corresponding code. At the same time, in the learning process, it is best to use two or more languages to implement this mode, so that it can be implemented by comparison, how to implement the code, master the mode in this case. So, it is best to master C and Java, and then exercise during the learning mode. 3) Learning to be dedicated. In actual work, when a problem has been solved, you must summarize your own experience. At the same time, it is necessary to express this experience design pattern, so that when you encounter this problem, because the mind already has this The mode of mind is existent, it can solve the problem quickly. Or when you see someone else's source code, you should pay attention to summarize and form your own design mode. In a word, there is only a constant learning to succeed. 4) The most important point, don't always hold the concept of design model. GOF's << Design Model >> One book proposes basic 23 design patterns, but these design patterns have changed in practical applications, and it is impossible to grasp all. As long as you remember, you will not leave it. The meaning of the design pattern is that there is a specific concept to summarize our experience, not for the moderate learning mode, should be to learn the model for a specific solution. Only in this way, you will not be confused by those thousands of modes. Finally, I want to make a little more, I want to think more, I will move my brain, sum up my experience, so that our code life will become more interesting.