1, the basic characteristics of the object
- Each object has its own unique identity.
- Objects communicate with each other through a message.
- The object is always in a certain state.
- Objects have several behaviors that fall into three categories: Create new objects, communicate with other objects, and change their state.
- The state of an object can only be changed by its own behavior.
- The state of an object can be composed of multiple other objects ' states.
2. Different levels of abstraction of objects1) class: Static, defined in the program. 2) object: Dynamic, present and in progress. 3) Abstract data type ADT
- is a higher level of abstraction of a set of objects.
- adt= Data + operation.
- Four paragraphs of ADT:
-
- TYPES
- FUNCTIONS
- Axioms (axiom)
- Preconditons (Prerequisites)
- ADT VS. Class
-
- Class =adt+ Implementation
- The "thin limit" of the class (that is, no implementation is implemented) =adt
- The "Fat limit" of a class (i.e. fully implemented), the effective class
- Adt--> class
-
- Specifications for ADT
- Select a physical representation
- Mapping ADT functionality to a specific physical implementation
3. Basic Inter-class relationships1) Inheritance: a highly abstract approach.
- Hollow triangular arrow, solid line, sub-class to parent class.
2) Aggregation
- Nature: transitive, inverse symmetry.
- Hollow Diamond Arrow, solid line, group element class points to the combination class.
3) Association
- Chain: A physical or conceptual connection between object instances.
- Association: An abstraction of a set of similar chains of semantics and structure.
- A chain is an instance of an association, and an association is an abstraction of a chain.
- Affinity can break encapsulation.
4) Aggregation vs. Integration
- Aggregation: With, is part of
- Inherited: Or, is a
5) Aggregation vs. Association
- Aggregation is a special form of association
4. Messages and Events1) Message: The construction or structure of communication between objects.
- There are two types of request message and completion message (by message mode).
-
- Message mode: Send object, receive object, content.
2) Event: The delivery of a message between objects.
- Multiple events can form a time series in chronological order.
3) Message vs. event: Static vs. dynamic. 4) Messages and objects
- An object can accept multiple messages of different forms and different contents.
- Messages of the same form can be sent to different objects.
- For messages of the same form, different objects have different interpretations of the object and can react differently.
5) Messages and methods
- When an object receives a valid message, it always responds appropriately to some behavior. During, the object behavior uses the code implementation of the class operation.
- In a way, messages and methods can be considered synonyms. However: The message is code-independent, and the method is the code implementation of the operation.
6) Message delivery vs. procedure Call
- Message delivery
-
- When the same sending object wants to send the same message multiple times to the same receiving object at different times, the receiving object responds differently according to its current state.
- Message passing can be done asynchronously, allowing parallel and distributed execution.
- Procedure Call
-
- If there is only a local variable in the procedure body, when the same caller invokes the same procedure with the same parameter value, the result of the call is necessarily the same at any time.
- A procedure call can only be synchronized, and its essence is serial execution.
5. polymorphism1) meaning
- The same action object can be a behavior of multiple different classes.
- When different objects receive the same message, they can produce a completely different reflection.
- The same message can call different methods.
2) Objective: to allow each object to respond to common messages in its own most appropriate way, enhancing software flexibility and reusability.
6. Object-oriented features and themes1) Features
- Identity uniqueness
- Classification of
- Polymorphism
- Inheritance of
2) Theme
- Abstract
- Packaging
- Merging data and Behavior
- Share/Reuse
- Emphasize object structure rather than program structure
- Collaborative
3) Object-oriented = object + Category + Inherit + message
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
UML (ii)--the basic concept of object-oriented