Object-oriented to the model to the real direction-oriented

zhaozj2021-02-08  471

From the object-oriented to the mode to the true object-oriented Alan Shalloway, transparent

(Interpoxity: This article is taken from the preface part of Design Patternal ON Object-Oriented Design. By this article, readers can probably understand the process and effect of learning design mode. At the same time, the author modest and cautious attitude is also very worthy of us. Chinese software developers learn. Translators retain all rights this paper. If you need this article for non-profit purposes, please inform me: gigix@263.net)

Many places in this book review my own experience in learning the design model. Before studying design patterns, I think it is an expert for object-oriented analysis and design. I have done some customers in various industries, I have done some designs and implementations. I will use C and have begun to learn Java. The object format in my code is beautifully packaged. I can design excellence in the inheritance system. I think I have already understood objects.

Now look back, I found that in fact, I didn't know all the abilities for object-oriented design, although I have been doing it in a manner in accordance with expert advice. Until I started learning design mode, my object-oriented design capacity has been extended and deepened. Learning design patterns have made me a better designer, or even when I haven't used them directly.

I started learning design model since 1996. At that time, I was working on a C /-oriented design consultant in a large space company in the northwest. Several people persuaded me to lead a design pattern learning group. It is there I encountered another author Jim Scott. There have been a few interesting things happening in that learning group. First of all, I started a fascination of the design model. I can compare my design and other more experienced designs, I love this feeling. On the other hand, I found that I didn't complete "design" for interfaces ", and I didn't pay attention to" whether an object can use additional objects without knowing the type of additional object. " At the same time, I noticed that the object-oriented beginners - usually they are considered premature to learn design models - from this learning group gets the same as the object-oriented expert. The design pattern exhibits excellent object-oriented design examples and expounds basic object-oriented design principles, and these make learners' design faster mature. After the end of the learning process, I am convinced: design mode, this is the best thing in software design after the object design is invented.

But let's take a look at my own work, I found that I haven't bonded any design mode in my own code.

At that time, I just thought that I haven't learned enough design model, but also need to learn more. At that time, I only knew six design patterns. Then I can say that I have got an eunuch. I have a target design consultant in a project and need to create a high-level design for this project. The leaders of this project are extremely smart, but in the object-oriented design, he can say it is a newbie.

This problem is not difficult, but it is necessary to pay attention to ensure that the code is easy to maintain. According to the practice, after two minutes of problem, I have a design - using the abstract path of data I have used. Unfortunately, it is obvious that this will not be a good design. Simple data abstraction has made me taste the taste of failure. I have to find some better design ideas.

Two hours have passed. After using all the design technologies I know, the situation is still not improved. My design is basically the same as before. What I feel that I feel frustrated is that I know there must be a better design, but I can't find it. More ironic is, I even know that four design patterns "life" in my question, but I can't see how it should use them. Here, I, a person who is considered an object-oriented design expert is trapped by a simple problem!

I really feel very frustrated, so I stopped and started walking around the wall to awake the mind and told yourself: at least 10 minutes I no longer think about this problem. Oh, after 30 seconds, I started thinking it again! But I got a kind of understanding and completely changed my design model: design mode could not be used as an independent terms; I should put the design mode together. The mode should be combined to solve a problem together.

I used to hear this sentence before, but I didn't really understand it. Because the mode in software development is often introduced as "design mode", I always work hard to work hard in "The most important contribution of mode is in the design phase". My idea is: In the design world, the model is like a beautiful connection between the class. Then I read Christopher Alexander's surprising book - The Timeless Way of Building. I have learned: The model exists in all phases - analysis, design, and implementation. Alexander discusses how to use how to use the model in the book to help understand (and even) the problem area, rather than just understand the model after the problem is used to create a design.

My mistake is: I tried to create a class in the problem area, then sewing these classes to form the final system - AlExander to call such a process as "a bad idea". I have never asked myself: Do I have the right class? Just because these classes look so correct, so obvious. I have, I immediately entered my mind when I started analyzing, and our teacher told us that "noun" should be found in the system's description. But my mistake is that I just try to put them simply.

When I returned, I started using the design mode and Alexander to guide my class, just a few minutes later, a good solution reveals in my mind. This is a good design, so we apply it among the products. I am very excited - I have designed a good solution for me to more design mode. Since then, I started combining design patterns in their own development work and teaching.

I started to find that those programmers who have just started learning to design objects can also learn design patterns. And they can make the foundation for their own object-oriented design capabilities during this learning process. This is true for myself, and those students who are teaching are true. Imagine my surprise! I have read the design pattern book and the design model experts who have talked to me have told me that before starting to learn the design mode, you really need to carefully conduct basic training of object-oriented design. However, I have seen my own eyes while learning those students for object-oriented design and design patterns. They have the progress of object-oriented design than those who only learn object-oriented design. Even the progress of them mastered the design pattern is almost as fast as those with experience in object-oriented practitioners.

I started to use the design pattern to do my teaching foundation. I started to call my course "mode-oriented design: from the design pattern of the implementation".

I hope that my students can understand these patterns and I found that the use of an exploration process is the best way to help them understand. For example, I found that if you want to explain Bridge mode to the students, I'd better demonstrate a practical problem to them, then let them try to design a solution for this issue. I will give them some guiding principles and strategies - I found that most design patterns pointed out these. After this exploration process, students finally found solutions - known as Bridge mode - and remember it.

In any case, I also found that these guiding principles and strategies can be used to "derive" several of these design patterns. "Delicate a design pattern", I mean this sentence means: If I see a problem and know that I can solve this problem with a design pattern, I can get this mode through these guidance principles and strategies. The solution is expressed. I clearly pointed out to my students, we won't really get design patterns through this approach. I just clarify a possible thinking process. The detectors of the pattern have been initially based through such a process, and finally classify the solution into design mode. A small diagram

In my opinion, these guidelines and strategies are very clear. Of course, they have a description in the design pattern of the "Four Gang". However, since I have limited myself to the object paradigm, I spent a lot of time to understand these principles and strategies. Until I combined with the work of the four men and Alexander in their own thoughts, Jim Coplien works in versatility and variability, Martin Fowler after the work in the methodology and analysis mode, these principles are clear enough, I can Talk about these principles with others. This helped me to decide to explain some things to others, so I will not excessively easily imagine my ability - when I just work for myself, I can easily produce such an imaginary.

My ability can help me better explain these very powerful principles and strategies. And when I start explaining more four-person mode, they are more useful. In fact, in my design pattern, I use these principles and strategies to explain 12 to 14 modes.

I also found that I started using these principles in my design, whether or not to use design patterns. This didn't surprise me. If you use these principles and strategies, you will eventually have a design pattern in my design. This means that they give me an excellent design method (because design patterns have been recognized). If you use these technologies, don't I get a bad design because I don't know if a pattern - no matter whether it appears - the name?

These comprehension helps me better conduct my training process (and my current writing process). I have made my teaching several stages. I am teaching the foundation of object-oriented analysis and design. I am teaching the design model in the course, using them to explain the excellent object-oriented analysis and design. In addition, by using design patterns to teach object-oriented concepts, I will make my students understand the principle of object-oriented. And through learning guidance principles and strategies, my students can now create a design of quality and model.

I am here to tell this story, because the model is almost the same as my course. In fact, from the third chapter, this book is basically my two-day course - moderate-oriented design: from the first day of the analysis to implement.

Read this book, you can learn these patterns. But more importantly, you can learn: Why can they work? How do they work together? And the principles and strategies they rely on. This will be helpful for you to accumulate your own experience. When I show a problem in this book, if you can think of a similar problem you have experienced, this will be helpful to you. This book does not tell new knowledge or new models, but gives you a new perspective that looks to object-oriented software development. I hope that in your study process, you can form a strong alliance after your own experience is combined with the principles of design patterns.

Alan Shalloway November 2000

转载请注明原文地址:https://www.9cbs.com/read-493.html

New Post(0)