Thursday, October 14, 2010

Several important concepts of object-oriented [1]


鈼?OOP's main features:
Abstract (abstract)
Packaging (encapsulation)
Succession (inheritance)
Polymorphism (polymorphism)
Association (association)
Polymerization (aggregation)
Combination (composition)
Cohesion and coupling (cohesion & coupling)

A single type of packaging encapsulation abstraction Abstract
Polymorphic inheritance hierarchy inheritance polymorphism
Association between type of portfolio composition association aggregation aggregation
Programming criteria: cohesion and coupling cohesion & coupling

鈼?abstract Abstract: the common things drawn to outline a unified approach to describe the process. The existence of different levels of abstraction.

Needs in different circumstances, what we in the end the abstract into the class as an instance or object to what is object-oriented design of a most critical step in the beginning, if the abstract excessive increase may cause the program to design levels, but if the abstract Bugou In extreme cases, may degenerate into the kind of process-oriented design of a program corresponds to a problem situation.

Ignore the details of an object or entity concerned only the essential characteristics of the process of streamlining its functions and formats to help users interact with objects.

鈼?packaging (encapsulation)
Hidden data and the achievement of
Provide public methods for users to call the function
The object two views
- External view: the object can do work
- Internal view: how to accomplish the work object
- TV: Adjust the volume

鈼?succession (inheritance)
Types defined by the existence of new types of mechanisms.
Usually exists between the two types "is a" or "kind of" such a relationship.
Can achieve code reuse through inheritance, polymorphism is also the basis of inheritance.
Such as the Apple "is a" fruit.

鈼?polymorphism (polymorphism)
A name, many forms.
Method of overloading a class is a multi-state.
Inheritance-based polymorphism.
Method is called when the object according to the different treatment of different options.
If Football - play (): use the foot to complete.
Basketball - play (): Use hand to complete.
Give a specific football or basketball, you automatically know who's approach to the implementation of using play ().

鈼?association (association)
Interactions between objects as a reference method.
When an object to another object through a reference to another object using the service or operation, the two objects will be created between the association.
Such as the person using the computer, person and computer, there exists a correlation between the relationship.
person
(
Computer.PlayGame ();
)

鈼?polymerization (aggregation)
An association relationship, an object to become part of another object.
Is a stronger association relations.
Between two objects "has a" kind of relationship, one object to another object's properties as the existence of the external object is in production may be associated with the client within the specified object.
Such as cars and tires, car tires as an integral part of it and the car can be assembled in the production of future use, but the car can be new tires, the tire can be removed to give other cars to use.






相关链接:



The outcome of the Countryside helpless computer



Intrusion Detection (ID) FAQ (on)



10 DAYS of the first day of the Institute of ASP.net



M2TS to MKV



To build customer-centric VALUE chain



Lists People - Screen Savers



XviD To MP4



for you Icons



Everyone doing B2C Who will win?



MKV To Zune



Operation of supermarkets to dealers Suggestions



DB2 pureXML a portfolio of dynamic programming: iBatis + BeanUtils + JiBX



after THE recent binocular revolution how do i



No comments:

Post a Comment