I'm sorry to say that my theoretical work is not solid enough. I usually understand it myself, but it is a little difficult to describe it and make people understand it. This is not the case. We have been involved in nine-year-old sisters! I admit, I got stuck! In other words, I eat a pound of Earth and have a mouthful of teeth. In order to give more puzzles and save lives, I boldly picked two interesting comments on the Internet, if you know, jump out. Haha ~~
PS: the following content is taken from the internet. I will not issue a birth certificate or other documents. If there are similarities, they are purely public opinions. Please withdraw them from law enforcement!
= Article 1:What is an object? In our words, it is a real thing created based on its template (class. What is a class? It is just a model. For example, we sometimes eat fish and flowers during the Chinese New Year, right? The fish flower has a wooden model, put the surface in, and then press so, it will come out of the fish-shaped steamed bread. The model here is a class, and the fish-shaped steamed bread here is an object. Then, you have engraved the stripes, eyes, and so on (members of the class) in the class, and then the fish flower (that is, the object) it also has its own eyes, Stripes, etc. Then it suddenly realized? Don't worry. It's hard to understand at the beginning. It's just an easy talk. It's just what our teacher said. Let me tell you by the way, I learned this question for two weeks... there must be such a process, and object-oriented, simply put, is that Java basically creates an object first and then programs such a process, and you will understand it ~!
= Article 2:Object-oriented (my personal understanding only): it encapsulates the implementation part and only provides the calling interface for the user, making the program easy to reuse and maintain. It also enhances the protection of internal data. For example, define an object China: it has a public method (Interface): Fire (fire), a private member: Money (money), a public member fury (anger) now, Japan is a flea on a fishing island. to declare war on Japan, we only need a code like China. fire, all callers don't have to worry about it.) At the same time, China's public data member fury Japan can see that the anger index has reached 9.9, and Japan is scared, however, China's private data member money cannot be accessed by the outside world, so Japan cannot know how much military spending we have. The object-oriented method can not only protect programmers from hiding Implementation Details and data security, but also simplify users' operation methods. See China. fire (Japan) is easy to create in Japan. It can be used by young people or even China immediately. fire (laomei, laomei, laaoo )...
For more information, see the following. If you are interested (and have time), please sink. A free shuttle bus is provided for ggmm that has not been harvested.= [Walk you]
= Article 4:Object-oriented refers to dividing a problem transaction into various objects. The object is created not to complete a step, but to describe the behavior of a thing in the whole process of solving the problem. For example, wuziqi, the process-oriented design idea is to first analyze the problem steps: 1. Start the game, 2. sunspots first, 3. Draw the screen, 4. Determine whether to win or lose, 5. Turn to the white, 6. Draw a picture. 7. Determine whether to win or lose. 8. Return Step 2. output the final result. The above steps are implemented using separate functions, and the problem is solved. The object-oriented design solves the problem from another idea. The entire Wuzi game can be divided into: 1. Black and white sides. The two sides act exactly the same. 2. The board system is responsible for drawing pictures. 3. The rule system, determines such as foul and win or lose. The first type of object (Player Object) is responsible for accepting user input, and notifying the second type of object (board object) of the changes in the layout of the pawns, when the checker object receives the I change of the pawns, it is responsible for displaying this change on the screen. At the same time, it uses the Third Class Object (rule system) to determine the game board. It can be seen that object-oriented is to divide the problem by functions rather than steps. The same is drawing board games. Such behavior is distributed across multiple steps in the process-oriented design, and different drawing versions may appear, because the designers usually take into account the actual situation for a variety of simplification. In the object-oriented design, plotting can only appear in the chessboard object, thus ensuring the unity of drawing. The unified functions Ensure the scalability of the object-oriented design. For example, I want to add the regret function. If I want to change the process-oriented design, I need to change the input, judgment, and display steps, even steps must be adjusted on a large scale in sequence. If it is object-oriented, you only need to modify the chessboard object. The checkerboard system saves the chess spectrum of both sides of the black and white, and simply backtrack the Board object. The display and rule judgment do not need to be taken into account, at the same time, the calling sequence of the object function is not changed, but the changes are only partial. For another example, I want to change this wuziqi game to go game. If you are looking at process design, the rules of wuziqi are distributed in every corner of your program. If you want to change the rules, you should rewrite them. But if you are an object-oriented design, you only need to modify the rule object. Isn't the difference between wuziqi and go rules? (Of course, the size of the Board seems to be different, but do you think this is a problem? You just need to make a small change in the checker object .) The general steps of playing chess are not changed from the object-oriented perspective. Of course, to achieve changes, only the design personnel must have sufficient experience. Using objects cannot guarantee that your program is object-oriented, A beginner or a very poor programmer may be able to face the process with a virtual object-oriented approach. The so-called object-oriented program designed in this way is difficult to have good portability and scalability.
= Article 3:When talking about object-oriented, there should be nothing to say. For more than a decade, this is not a new concept but a de facto development standard. However, for most beginners, or even a few coder, oo is a concept rather than an idea. So how can we understand OO? First, you must understand the meaning of the object. Objects are all objects in developer's eyes. For example, when we get up in the morning, we can open our eyes and see that the sky (object) is bright. This is because there is light (object), and we can look up outside the window (object, the sun (object) has come out... objects that we can name are objects, and instances of these objects ). So object-oriented is first oriented to all instances that we can access. But there is a problem in this way. I want to say this: in the morning, when I get up and open the object, the object is bright. It is because there is an object, and the object is out of sight... not only am I confused, but you have to scold me for my mental illness. This is a colorful world because the various object instances we come into contact with are very different. If you look at the past as an identical "object", I will go crazy and believe you will. Therefore, we will segment these objects according to different instances: eye-opening (Object: Eye), eye (Object: sky), light (Object: Light), head (object: head) outside the window (Object: Window), the Sun (Object: Sun) came out... is it clear? So how do we differentiate these objects? There is a sun and a moon in the sky, and we know from an early age that they are different, even for no reason. Why? Because their appearance and activity patterns are very different, this is their unique characteristics. Some of these features can be described using numerical values. For example, a dog with a shoulder height of more than 38 cm belongs to a type of Big Dog (which is characteristic of some of our best practices). These are the States of objects; some are determined based on their actions. For example, a dog that can be called does not bite people (never believe it !), These are actions of objects. All objects are identified by their States and actions. For example, if you see an object, it has 5 tons of weight, 3 tall, four legs, and a long nose, two big white teeth, even if you have never seen it before, you should know what it is, because it has these characteristics we have seen at least from books. For example, when I typed this text, there was a strange itch on my leg. I knew there was at least one mosquito in the room and it was still a mosquito lady, because I already know that in this case, only female mosquitoes have the "ding" behavior. A new problem arises. For example, there are many pets in our community, and every evening the dogs and cats are busy. It seems that all dogs are dogs, cats, and cats, but each dog has a different one. The reason is that their main statuses and behaviors are identical, but they all have their own unique characteristics. So we have to continue the subdivision, so we have a class ). The status of a class is called a property, and the behavior is a method. I know that GIWA are dogs and sinaray is also dogs, but the difference between the two is huge. But they all have the main attributes and methods of dogs (don't think GIWA won't bite people, try it? They all belong to class canine ). I also know that dogs belong to class Mammalia, mammals belong to class zoology, and animals belong to class biology. What about biology? I don't know (I'm sorry for being a biology teacher in the middle school, huh, huh). I just want to classify it as an object. OK. Sort out: Object -- biology -- zoology -- mammalia -- canine -- schnauzer | chibaihua? Very familiar. By the way, ignore the object and add other branches to the biological classification tree. I'm not a biologist, but I know that a biologist is going to study dogs and animals. He decided not to try to find a canine, because there is no such thing at the root, he can only study schnauzer, chibaihua, or any other dog that can be found, because we only have access to instance! Well, you should have some thoughts here. Wait. What is the most important class! When beginners get started with OO, they are often confused by classes. Many textbooks refer to the following sentence: "To understand object-oriented, you must first understand classes !", Then, grab the class and try it out. It's okay if you have a large amount of wine. Otherwise, you will inevitably get dizzy. Why haven't I talked about classes? The class is abstract and a set of attributes and methods of objects. You have figured out the objects, instances, attributes, and methods, I don't believe that you don't know what the class is. Next, let's take a look at the definition of these terms in software development: objects-objects are everything that people want to study, from the simplest Integers to complex aircraft, it not only represents specific things, but also abstract rules, plans, or events. -- Is it difficult for a professional explanation? An object has a state, and a data value is used to describe its State. -- Since an object is an object, it will certainly be in a State. For example, my current state is "sober", "ELE. Me" (first look for something to eat), and "behavior". It is used to change the object state. -- The object is either active and can be changed by myself. For example, if I am sleepy, I will go to bed and the status changes when I go to bed. (If I fall asleep, I will not be hungry ~~ 55 ~ I can't find the one that can fill my stomach); I can either die or be changed by a living object. For example, if I find a pack of noodles, I promise it will change its status quickly. Objects combine data and operations to encapsulate data and operations in the unity of objects. -- I thought about this text, typed it out, and I had to come by myself (if I had a secretary... at least I have to talk about it.) I have my own knowledge (if not, it will be pirated ). Class: the abstraction of objects of the same or similar nature is a class. Therefore, the object is abstracted as a class, and the class is embodied as an object. It can also be said that the instance of the class is an object. -- It's a bit confusing. If you come up, it's strange that you don't care about the object. A class has properties. It is an abstraction of the object state and describes the attributes of a class using a data structure. -- Think about what sort of creature Scientists rely on. A class has a method, which is the abstraction of the object's behavior. It is described by the method name and the Operation to implement this method. -- Have you ever been bitten by a dog? No? Have you ever been bitten by a mosquito? A class has an event. It is a message of an object that notifies the object of an important situation and allows communication between different tasks. -- How do you feel when you are bitten by a dog or a mosquito? No? Kao! I took u! We have to mention that the structure for communication between message objects is called message. In an object method, when a message is sent to an object, the message contains the information of the receiving object for certain operations. To send a message, you must at least specify the name of the object that receives the message and the name of the message sent to the object (that is, the object name and method name ). -- Think about the process of making a call or sending an email. The ultimate goal of our research object and class is to deliver messages. For us, there is no meaningless state or action in the world, and all of these messages we understand as messages that recognize objects.
Haven't you seen enough yet? After work, there is a free shuttle= [Walk you]