UML (ii)--the basic concept of object-oriented

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.