Also talk to object-oriented
Liu Qiang May 25, 2002
What is an object-oriented design idea? There may be many beginners have many things that don't understand this concept, especially this era in the alternating thought, many people have just learned that it seems to be eliminated. It is just a process-oriented language. Their brains have not been detached from the binding of process ideas, and they find out that "object-oriented" has already been popular, this strange word is flourishing. Just pick up a popular computer technology book, there will be no "object-oriented" words! So I am confused: What is "object-oriented"? Not interested, have passed; "I am interested in this area, and I have a hurry to find a book to bother what is" object-oriented ". However, to break through the shackles of thought, it is not difficult to say that it is not easy to understand. After doing some lightweight work, the author is quite a bit of a bit, not afraid of generous laughing, writing has been made to the majority of collation.
"Object", the word "Object), as early as the nineteenth century, there is a phenomenological master Hussell proposed and defined. The object is the image of the object in the human brain. It is the reason why people's consciousness reflects, which is a convention and the presence of the presence, and it also includes people's will. For example. When we realize a new object, it is a tree, so it has formed a tree in our consciousness. This concept will always exist in our thinking, and will not disappear because this tree is cut off. This concept is the image of the object in the real world in our consciousness. We can also have our own will. Although we don't need to put it into the implementation - as long as you want to cut this tree in your mind, you will call it. Thus, the object is the image and human intention of objects in the human brain in the objective world. As long as this object exists in our thinking consciousness, we can judge what the same species. For example, when we see another tree is, it will not know this tree because the first tree seen is not losing the reference template. When we come into contact with certain new things, our awareness will establish an object for these things. Of course, this process is formed, that is not what we can discuss.
The objects mentioned above have a general problem, so it can be pushed to everything. The "object" we often say, and a class refers to the method of solving problems encountered in the information field. Especially the method of application technology to solve problems. As we often encounter, object-oriented programming, object-oriented analysis, object-oriented design (Object-Oriented Design). Applying the concept of objects described earlier to further analyze these issues. In the face of more complex systems, we can analyze it as an object. A system (a full set of solutions to a problem) as an object, can consist of multiple parts. Again, this object can also be composed of multiple objects. For similar things, it can be represented by an object. The benefits of doing this are obvious, it is flexible and efficient, which can greatly reduce the workload of designers and simplify the actual model. for instance. In the design of the relational database, we can use a tuple as an object to define a set of operation methods. These methods will apply to all tuples, so we don't have to take care of different tuples in a larger range (such as whether an element is legal): Because they have a group of public facing itself, they "own" Can "solve" your own problem. The object of the next layer can be a table, view, etc. Table objects have their own methods on the basis of tuple objects, such as increasing, deleting, etc. From this level, it only needs to do "own" things, because there is a support of the group object, it does not need to take into account the legal such as elements. Even, sometimes in order to meet the elements or table groups as timing objects and define their own methods. This makes it possible to display object-oriented advantages.
The above discussed can be said to be an object-oriented analysis method. In the specific design process, appropriate ways should also be adopted. Because of the object-oriented thought is very advanced, if you do bad, you can also achieve the expected results. This is mainly manifested in the relationship between processing objects and objects, and the object is not clear. As an example of the relational database above, if you have an object at the meta level, a table object is considered, or the object excessively considers the factors of a tuple object, even considering the element. The factors on the level are not a good object-oriented design method. This, in terms of language implementation, Java is more advantageous than C because it does not allow multiple inheritance, so that the relationship between objects is more clear. No one will deny C 's function more powerful, but it also has a huge price - when the code library grows to a certain level, the level of the object will become abnormal and complex. Users have to learn, understanding is very difficult, and it is difficult to grasp. In addition, although C has object-oriented processing power, it still retains many process-oriented things. Using C , you can use C to perform programming, of course, people will not do this - except for beginners who only regard C as c, this is a hidden danger for future development. On the one hand, Java's limit is more. Others are still not enough. What is developed is human, and the development method is determined by people. To apply an object-oriented approach to developing excellent software, you must ask the developer to have a good object-oriented thought. Good engineers can develop excellent software with appropriate tools - instead of the language tools he use - Java, C , Object Pascal, ADA, etc. To apply the object-oriented ideology to do systematic analysis, design, implementation (programming), first requiring developers to know what objects, what is object-oriented concept, otherwise it is not to apply the application for object-oriented ideas to engage in software development . I hope the reader can see the concept of "Object" by the concept of "Object" after seeing me in front of it, and I also hope that there are different opinions. Second, it is also required to have a relatively abundant development experience. Otherwise, the theory of light talk is not to truly understand the meaning of "object-oriented". Despite this, we can still set a general rule. Those out other stages of the life cycle, generally perform the following processes for a established system: 1. First, the systematic analysis of object-oriented thinking is first applied. Carefully divide the various parts of the system, clarify the hierarchical relationships between them, and then perform various parts as an object. For example, to design a user interface, it may consist of several primary forms: the main form mainframe, functional child form functionFrame, and dialog dialog Dialog. Where the MAINFRAME may also include Windows components such as menus, toolbars, text boxes, and status bars. For components to complete some important functions, we can use it as an object, in a specific implementation, in a single class. And some are not very important, just the components needed during the process, you can integrate them into other objects. To clarify your own tasks - don't let it have a defect, you can't get it. The relationship between the objects is achieved by coupling process, content, and function. In fact, if you are developing with Java, you will find that the Swing component itself is very easy, because the relationship between them is very clear - you don't have to understand the complicated relationships as components in C in C . When developing your own components, you also need to achieve this effect.
Second, the application of object-oriented thinking is used for system design. In fact, after the work of the systematic analysis is truly, it is relatively easy. This time as long as it further determines the functionality of each object and the relationship between the individual objects. In order to better help realize the relationship between the individual objects, some tools can be used to expand the relationship between these components, unified model language (UML) is such a good thing. It not only helps developers understand the entire system, but also provides a file file for future maintenance work, providing huge convenience to future work.
Third, implement (encoding). This is not too much to say. In my next article, a relatively simple instance will be given, I hope to be inspired by the reader.
When you engage in software development, the code is not the most important. Analysis, design is the most important. Maybe after we have accepted some more advanced ideas, it will be more understanding. I hope that our China's software developers can develop international competitive outstanding software.
Welcome to letter and I discuss: CAMBEST@sohu.com