Talk about object-oriented

zhaozj2021-02-16  51

Talk about object-oriented

Liu Qiang

2002.8.18

This article structure:

First, the purpose of the article

Second, the concept of the object

Third, what is an object-oriented?

Fourth, the importance of design patterns

V. conclusion

I wrote a "I also talk about object-oriented", introduced some concepts of object-oriented. After the article is posted, the heart is full, and I am afraid of being cast aside. I have a criticism, there are still a few articles. I feel inspiring; I think that there are many shortcomings in the previous one, so I will write this article, explain that I can't express it, wrong, and 漏, thank you all supported me in a table. Peers.

Talking about object-oriented, this article has a lot. However, it is clearly given the definition of the object or a very small definition of the object - at least I have not found it yet. It is the first, "object-oriented" is specifically designed in programming, inheritance, abstract and other design methods. However, this definition is clearly unable to suit the current situation. Object-oriented thinking has involved various aspects of software development. For example, object-oriented analysis (OOA, Object Oriented Analysis), object-oriented design (OOD, Object Oriented Design), and we often say object-oriented programming (OOP, Object Oriented Programming). Many of the object-oriented articles are just about the problem you need to pay attention to or the preferred design method used in the object-oriented development. See these articles only have what is truly, what is object-oriented, in order to maximize your help. At this point, I am afraid that people who have even have been engaged in related work for many years will also be blurred. Below I start from the general concept, and then the concept of the object involved in the field of software development.

In the previous article, I once held an example of a tree to illustrate the concept of the object. Here I still use it to explain the concept of the object. "Object", English is "Object", German "Sachen" can be translated to "objects". In fact, all objects can be used as our object - as long as we pay attention to it. A person came from birth to the first outdoor activities, he will expose a lot of fresh things, he will look at this strange thing curiously. Maybe, those tall things, dry, branches, leaf - although he didn't know these - its image was deeply impressed in his mind. At this point, the tree is not an object, because there is only a tree in his brain, not the spiritual intention of the tree. When he is bigger, maybe he will think about climbing to the tree to play - but the tree is not his object. The existing object is just himself - he wants to do something. After grew up, maybe he became a carpenter - just like we became a programmer, with his saw, ax, cut a tree to make a table - just like we use Java, C / C Language develops a set of database systems. Here, the tree is a carpenter's object, and the database system is the programmer's object. So, I will give the object here: the object is the material awareness and spiritual awareness in the human brain. It is popular, that is, things in the human brain and the intention of the human brain. The reason why "things" are emphasized here, I want to explain that "material" mentioned here is not physical, thinking activities, and things between things. We are also known as substances.

It is a very complicated to discuss what is the object in a deeper level, because this should be involved in the problem of spiritual awareness, far beyond the scope of our discussion. We don't discuss what a deep question is practical. I will use this concept to give a simple example. There is a table in front of the carpenter. He may have to face two questions: First, add some parts to the table such as drawers, so that the table can put more things; the other is to decorate the table, make it more beautiful. Here, the table is his object - he thinks about the table, which makes his intention of the table clearly reveals. We can even refer to the transformation table as "object-oriented transformation", because it is not an arbitrary transformation. I will mention why it is "not casual transformation" in the instructions for object-oriented ideas. Consider "object-oriented", you can know that it is a phrase of a mobile phone. The verb "face" surface, this phrase contains "how to do", which can be said to be a category of methodology. This also gives us an important message: "Object-oriented do ..." Not only involves what is subject to the problem, but also involves how to do it. How do carpenters do his desk, we don't have to worry: he will definitely do well - if he is a good carpenter. He has a wealth of experience, he has a set of his own way, he knows how to do it. Maybe in the table, a good design has been made to prepare for the later "upgrade". This is like an experienced programmer: He knows how to design to make your program clear, easy to understand, easy to troubleshoot, easy to maintain. One thing to note is that the object is not an entity, it can exist from the entity. This is because the object is just a product of human brain thinking activities; we can use some ways such as natural language, drawings, etc., just like the objects used in software development (in the program) or System structure diagrams (such as flow charts, hierarchical graphs, HIPO maps, etc.) are described.

So, we can object we generally define the subjects under the software development field: the object consists of a data set and the operation of the data set. This definition is suitable for classes in the program language, but also suitable for the entire system. Maybe everyone will feel very familiar with this definition: Is this not the definition of a program or process? Note that the object here is "self-awareness", that is, it has its own behavior. The "process" refers to a collection of binary streams, is an operational event. In the program, we use classes to describe the object, and the entire system, we describe it with system diagram. Here, the system is also our object. The data set is like the image of things in our brain, and the operation of the data set is like our intention to things. If we carefully examine the various parts of the system, they can also be considered as an object. "Object-oriented XX" is to ask us how to reasonably allocate the hierarchical structure between objects, making it clear, while maintaining efficiency, it is also easy to troubleshoot, maintenance. We have a professional noun to expressed its styled software method, which we often say mode. All walks of life have its own general method model, such as architectural models, software development models. I think that the reason why Einstein made a few ugly stools is because he doesn't know the design pattern of the stool. This is like a lot of programming initiators, a little bigger program will write messy, except for the code that you can't understand, maybe I don't understand it.

In the software development process, the analysis of the system (the ultimate object we face) is the most important. Both of these are closely combined. These two steps have not been done well, the following coding is difficult to play, can be said to be inch. Even if it is written, there is no analysis, the results of the design are definitely difficult to maintain. This is like a carpenter that is invited, and it is very unreasonable to make a set of furniture. It may be very un practical. Who will be willing to use such furniture? The package is not well design, who can use it? No matter who is used up, it will be very hard. If a project is not designed, even if it is developed, how can someone else take over? There are many examples in our Chinese software field. Of course, there are many reasons why this situation, China's system, the company's strength is also a major aspect. But how to do it, there is a wide range of topics. There are more tips above. Objects are a relatively broad concept, which is the same in our usual software. Objects can contain objects. For carpenters, a set of combined furniture is an object, and a wardrobe is also an object - global and local considerations. For them, how to design a well-collected furniture from the whole to some, is a rich experience and good design method. It is also true for us. In addition to laying solid basic skills, accumulating rich experience, but also pay attention to learning our predecessors to leave something, and good ways to peers. Now, there are many books, there are many articles, we should take a look and learn.

The full text said many, only talking about object-oriented concepts. Several friends have to believe how to divide the object level, the structure of the system is the importance of the system, etc., the boundary is limited, and There may be some friends to understand the object of understanding is not very reasonable. I will talk about my point of view. Objects have their life during system operation. However, in the operation of the object itself (eg, dynamically increases, reduced function, changes in data sets, etc.) cannot be seen as a change object. For example, for a binary tree, only root nodes are initialized, of course, we can see as a node object, but usually we look into a holistic two-fork object. When the tree is generated, it is still that object, but can't see it as another object. If you understand it, you have separated the various runs of the object, which is a misinterpretation with the concept of the object.

Since the level of level is limited, the discussion of the article and must have a wrong or wrong mistakes, please do not hear! Whether it is criticism or suggestion, it is a great encouragement for me! Email: CAMBEST@sohu.com.

[Description]

l "What is the image? I am also difficult to say. If you feel bad, you will replace it with "memory".

l The article "Object" and "object instance" is not distinguished. In fact, "Object" is an instance of a class, it is the same as "object instance".

[Reference book]

L Design Patterns: Elements of Reusable Object Oriented Software, Erich Gamma, Richard Helm, Ralph Johnsom, John Vlissides.

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

New Post(0)