Thinking of objects

zhaozj2021-02-11  263

Thinking of objects

In the book of more old discussions face the object of the object, the inheritance will regard inheritance as the most critical part. It is generally believed that the most core part of the method of facing the object is inheritance, because the problem from the perspective of inheritance is the most obvious difference between structured design. If the object does not inherit, the concept of objects and traditional modules is not much different. I don't have to be aligned with these two methods. I just think that the idea behind the object of the object is that the way should be different from traditional structured methods.

In a structured method, we must first consider the function of the entire software system, then follow the principles of some basic modules, such as high cohesion, loose coupling, and module fans and other numbers, etc. The function of the entire software is broken down into sub-function of each module. Of course, the module is generally considered to be a blackbox. In the design phase, you need to define the call rules of each module. I don't want to say that it is an interface, I want to use it below another place. After completing the design of all modules, the assembly should be able to achieve the entire software. Of course, this is the designed design. This kind of thinking should be said to be very natural, just like a wood, and we are also consistent with our usual thinking habits. He is not inappropriate why there is such a function, but thinking about how I implements such a function, of course we The goal is how to achieve, but his thinking method is very straightforward. This method has a lot of limitations. First, demand analysis is not very clear, and it will never be clear, which requires frequent changes to the original software function, which brings trouble because of the need to modify each module. Design, sometimes even fatal, will cause the original design to overthrow. This requires a very experienced designer. He must understand this software applicable industry, you must understand the future software development trend, and to predict the possible demand changes, this requirement is quite high, a designer's The level often determines a software survival time, even if he has a very good team, his poor design will still make this software become a flower. Second, the beautiful document brought by structured design, still can't bring considerable benefits for future maintenance work, most of the maintenance work is caused by changes in users, although beautiful and clear documents can be given later. The maintainer is very helpful, but still can't reduce their workload. The maintainer still needs a comprehensive and accurate understanding of the original designer when the maintainer is changed. Otherwise, even if there is a good document, maintenance work will still bring a lot of mistakes. In particular, when the user needs, there is a large change. I have recently changed, I will discuss later.

When the method of the object is starting, the first job is identifying the object, identifying the objects that appear in the problem domain, the most classic way is the noun that appears in the demand manual, which is reasonable, the language is the case of thinking, These nouns determine the connection between our minds, this way is to be lazy and the most natural way. The second step is to find the commonality between these already identified objects, of course, the object we are looking for should be able to cover the entire problem. Looking for commonality is to determine their common ancestors, and designers can have a further clear understanding of the problem during this process. The third step is to determine the relationship between the various objects in the problem, that is, the message passes between them, this does not refer to the message in Windows, huh, huh. This process is suffering, because it is necessary to determine the relationship between the objects, that is, more accurately describe the original problem, but it is also flexible, even if the understanding is, it is still a pleasant correction, because we are Understand the object, not the decomposition function, pay attention, I emphasized understanding, not design. At this time, we can submit our preliminary results to customers. If you have any questions, this modification will not be very difficult because we are not based on functional decomposition, but based on the object concept in the problem domain. We will not understand all objects to understand errors, understanding is just a part of one or less of the object. I think the essence of the object method is to force the designer to design software from why, not very direct, in this understanding process, very natural forming our design. In this mechanism, it is a key role that is inheritance. He is the bridge that is connected to how to do it. He naturally and unconsciously turns the designer's understanding of the problem into a solution. This is the case, that is because, in the real world we have long formed a way to solve this problem, we need to convert this solution into a computer description. The various concepts in our minds are the traces of various issues left in the real world. He provides a reference for us to solve similar problems. Please note that a fact, scientific research is to know what is, why, and Not to do, but we know what and why, we will know what to do. With an inappropriate example, there is a worker who is very dissatisfied with his salary, so there is a person to say to him, you have such a small salary because our country is still very difficult, society is still inverting, inevitable Some people have sacrificed, so this worker is very satisfied. Why is this worker satisfied? He has to find a way to solve him not full of salary. In fact, the concept of the country is sacred in his brain. In order to change a sentence, it is an uninterrupted force. This is the lesson of his growth path. When he does not respect the country, the teacher will punish the station. Then, the person's words, you can't resist the power of the country now, you now are the will of the country, huh, huh, this worker knows how to do it, it is in the current situation. Of course, he doesn't think so, his concept is I am lofty. This is a bit like religion, I have a little bit. However, understanding a problem, actually looking for a solution to solving problems.

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

New Post(0)