Object Oriented,oo is a software development method. Object-oriented concept and application has gone beyond the programming and software development, and expanded to such as database system, interactive interface, application structure, application platform, distributed system, network management structure, CAD technology, artificial intelligence field. Object-Oriented is a method of understanding and abstraction of the real world, which is the product of the development of computer programming technology to a certain stage.
--Baidu Encyclopedia
At first, object-oriented is the design method of encapsulation, inheritance and polymorphism in programming.
In the basic stage of C # Learning, we just need to know that means to invoke the method through the object can be, too obsessed with the concept but the idea is not accessible. Want in-depth understanding, life more thinking, development more knock code to experience, it is difficult to understand through the words of other people clear.
--Here are the explanations and suggestions I have touched and touched on:
1> want to learn more about object-oriented, read the Java programming idea, although the example is in the Java language, but the object-oriented thinking and C # are interlinked, and, in addition, learning C # is more or less exposed to Java.
2> This is more bold, object-oriented is a XX (skip, derogatory), you just need to know the code how to knock on it. My understanding is that in all these years I have not been able to unify a precise and understandable description, and we don't have to do the first one to describe it, to use it, to do more, to experience it.
3> This is the simple training that the director did when he was just taking part in the work, for development, practical:
Simple introduction to Object-oriented design principles (this is the simplest and most outrageous design principle I've ever heard):
1, open and closed principle--to expand development, to modify the shutdown--write code when you should pay attention to
2, the Richter replacement principle--applicable to the base class must apply to its subclass--inherit
3, relying on the reversal principle--as much as possible depending on the abstraction do not depend on the specific interface
4, interface isolation-using multiple dedicated interfaces is better than using a single total interface
5, synthetic polymerization multiplexing principle--as little as possible inheritance--to prevent the level too deep, difficult to control, do not have more than three levels of inheritance of synthetic aggregation implementation inherits two classes, so as to complete
Multiple inheritance. --Apply this rule in cases where multiple inheritance or inheritance levels are deep
6, Dimitri Law--why is it a law, not a principle?
--an object that knows as little as possible about other objects--internally implemented methods are not exposed externally and are passed to external calls as arguments, but
In fact, more than one parameter is difficult to control, as far as possible to use the parameters of the function (3 best), carefully expose some properties. In-Class high cohesion, low-class external coupling.
Of course these words do not rely on the code are more boring, but with specific code and easy to mislead, or in their own development when more with these problems to think better.
Then to understand a thing, in addition to its own to understand, contrast is also a good way to cut.
Here's a list of questions and answers Baidu knows:
Object-oriented and process-oriented differences?
Process-oriented is to analyze the steps required to solve the problem, and then use the function to implement these steps step by one, using a one-time call to be able.
Object-oriented is the decomposition of a problem transaction into individual objects, the purpose of which is not to complete a single step, but to describe the behavior of something in the whole process of solving the problem.
For example:
Gobang
The process-oriented design approach is the first step in analyzing the problem:
1, start the game, 2, Sunspot first go, 3, draw the screen, 4, Judge Win and lose, 5, turn to white son, 6, draw screen, 7, Judge Win and lose, 8, return step 2,9, output the final result.
The problem is solved by using separate functions for each of the above steps.
The object-oriented design is to solve the problem from another idea.
For example, I want to join the Undo function, if you want to change the process-oriented design, then from the input to the judgment to show the sequence of steps to change, even the steps between the sequence of a large-scale adjustment. If it is object-oriented, only with the change of the Board object on the line, the board system to save black and white on both sides of the game, simple backtracking can be, and the display and rule judgment is not to be taken into account, while the entire function of the object call sequence has not changed, the change is only local.
For example, I want to change this Gobang game to go game, if you are process-oriented design, then the rules of Gobang distributed in every corner of your program, to change is not as good as rewriting. But if you are the object-oriented design, then you only change the rules of the object can be, Gobang and go is not the difference between the rules? (Of course the size of the chessboard is not the same, but do you think this is a problem?) Just make a small change to the Checkerboard object. The approximate steps of playing chess have no change from the object-oriented perspective.
Of course, to achieve the change is only a local need to design people have enough experience, the use of objects can not guarantee that your program is object-oriented, beginners or very poor programmers are likely to object-oriented virtual process-oriented reality, so that the design of the so-called object-oriented program is difficult to have good portability and scalability.
C # Foundation One: Object-oriented Foundation