[ASP. NET Quick Start Guide 5] "grain" of Jin Yong group
-- Objects and classes of OO ideas
A few years ago, Li Xiaoyao, a young man named Yao zhuangxian, went across the north and south of dajiang, his reality cannot be realized, but his polygamous wife and money make my family go to a computer and several friends turn around every day. Just a little calm, the wisdom crown and the "Heroes of the Golden heroes" on the stall, so my poor Ben began to drag tired and keep working. According to incomplete statistics, my family's keyboard has been changed for less than ten times in-96 years. To reduce losses, I have to play the free "Yi" laq role for computer vendors.
Xianjian is better than the plot, and Jin Yong is more open. Therefore, xianjian must make great efforts to render the legend of the story. As a result, duojiao love, the three worlds of heaven and earth, magic and martial arts make full debut, and at the same time focus on the background situation of the story, beautiful pictures, beautiful music, vivid animation, as a result, you are immersed and intoxicated. The inspiration from the popular network mud is that there is a new martial arts game model with multiple clues and endings, or a positive or evil spirit, or a swordsman or an internal expert, giving players full freedom to shout freedom.
■ Circle the left hand and draw the right hand-oriented process programming ideas
Although the advanced language programming course was a required course for a university, many students may never understand how the world becomes an algorithm + data structure.
The computer system structure designed by Feng nuoman, a mathematician, is just like the mathematical formula on his draft paper. The process is clear and orderly. Under the premise of such a machine model, the early programmers are familiar with the process programming idea. As a result, the successors of the generation and generation had to break down the problem into exquisite process models and map them into machine models. They dreamed that they would be the same as Li Xiaoyao, you can make a wonderful journey.
But we have to admit that this mode of thinking is indeed different. People know the world first. Mom or Dad is the first sentence that everyone can say, only in this way can we consciously associate all nouns in a certain field with verbs to form a complete processing process. This means that it takes time for people to understand the process. In contrast, the premise for process programmers to work is that a correct process model is required. Unfortunately, even a completely correct process model is constantly changing, and the speed of change shows signs of increasing.
The process is usually unique. Yao zhuangxian, who is sad and lonely, creates the exquisite "Legend of the fairy sword and chivalrous man", and Yao zhuangxian, who is full of beautiful women, plans the plain "Legend of the fairy sword and chivalrous man 2". human activities cannot have a unified deduction process like mathematical formulas. Correspondingly, as a process abstraction-a function, which cannot be copied almost becomes its fundamental attribute, then the software reuse of a program composed of functions seems like a mirage.
The human brain can only be used with one mind, so it is difficult to draw a circle with the right hand at the same time. This is a well-known fact. However, many programmers have been doing a lot of seemingly absurd things-using serialization methods to simulate multi-task processing, that is, drawing an arc on the left hand side and drawing another side on the right hand side, repeat these two actions. As long as the action is fast enough, the feeling of others is your work. We have to sigh, but at the same time, we have to admit its complexity. The cost of complicated things is high. When there are a large number of events in various fields at every moment in the world, how can this exquisite solution become fragile.
The computer architecture designed by von noriman has a congenital defect, but it is unrealistic for the computer industry to completely overturn the whole system. Therefore, there is an improvement and a division of labor.
■ 9-9 normalization-object world of object-oriented thinking
Some of my rock friends in the legend of the Golden heroes have different habits from ordinary people: when watching a person, they do not pay attention to the appearance of the person, but their life and attack power. Before talking, I often subconsciously press it in the air with a big finger. after entering a strange room, stone eyes are usually directed at the cabinets and drawers for fear of missing pills.
When many people describe their legends of the legend of the Golden heroes, they often refer to "coming out of the Mouch, entering helo, and going to nanxian ...... "And so on, let's get started, and talk about the last half day, Ouyang ke wild ball boxing Baoji Pills and so on mixed, people can not help but learn more than just came up with admiration, you can chew back, but vaguely write down a few terms. The stone that has always admired Cantor describes the world like this: "A piece of cake is decorated with several strawberries, and an ant is here to go back and forth and drill into the strawberries from time to time. "
The first image we bring to us is filled with a variety of particles. We will meet Innkeepers, Ouyang Ke, and other people. We will receive items such as Baoji Pills and arms wujichen. We will learn martial arts such as the evil sword and the right-hand combat techniques; will be drilled into Shaolin Temple, Wudang Mountains and other places. At the beginning of the world, they were chaotic.
These particles have their own characteristics and behaviors. For example, Xiami has attack and defensive values to describe their current state, you can perform walking, medication, conversations, and duel actions to influence the status of yourself or others. We name all the particles as objects in a uniform way, and describe them with the right of Figure 5-2. All objects can be defined as a set, 5-2 left:
Listing all objects one by one is too troublesome and many objects are extremely similar. Therefore, we can use the equivalent division method of the Set (Figure 5-3 left) to simplify the description and use the class) to portray the Division (subset of the JINYONG group Xia object set), 5-3 right, we can actually find that the class itself is a set, and the elements of this set are the public states and actions of similar objects.
The process from induction to deduction is the core of Object-oriented Thinking: first, class is used to portray all similar objects and abstract the process from many to few is simplified; when using the class, the instance is derived from the class to complete the construction process from less to more. In fact, this is the idea that Cantor's simple set theory is infinitely real and infinite.
Let's take a look at interesting classes. First, it requires others to respect its privacy and hide all attributes and Methods unrelated to other objects. For example, in the case of Pingyi, he cannot control the walking of Xiami, we do not know how small shrimps walk. We call this feature encapsulation. Small Shrimps use private and public keywords to control whether their descriptions are open to the outside world, this is the basic premise of the software development factory model. In fact, in subsequent chapters, we can find that the actual application tends to encapsulate the attributes and methods of the class as much as possible, while other methods are used to complete the classification class.
The method of another class is changeable, that is, the overload is a situation of object-oriented ideology polymorphism. Overloading is an abstraction of similar methods. The purpose of this change is to make the methods simpler and clearer. Taking the drug-type medication method as an example, Baoji Pills and arms wujijing have different effects. The traditional method is to use a large number of switches or if nesting. The following can be corrected now, and the sending method can also be reloaded. The method name is unique for the outside world of the class, but the system will automatically call different implementations based on parameters during actual use:
Class characters
{
Private vitality;
Private essence;
......
Public medication (Baoji Pills) {vitality + = 3 ;}
Public medication (Arms wujijing) {essence + = 5 ;}
......
}