Details about the UML class diagram

The following describe in detail UML class diagrams

  1. Comment (Comment)
    Note that supplement to the class diagram, can be attached to any element, with the upper right corner of the rectangle represented Angular placed captions therein connecting element annotated by broken lines.
    Note
  2. Class (Class)
    in the object-oriented (OO) programming, the abstract class is a group of real world objects with the same characteristics. In UML class diagram, class containing a class name, property (field) and a method (method) and with a rectangular dividing line represented: class
    Full class representation attributes: Name Visibility: Type [= Default] wherein in brackets represent optional
    complete representation of the class of the method: visibility name (parameter list) [: return type] wherein in brackets are optional.
  3. Interface (Interface)
    interface is a special class, but the class structure can not be instantiated, but may be implemented (inherited).
    In UML, the interface expressed in two ways:
    a common interface notation (fly);
    lollipop notation (person speaking the words), using a small circle with a name to represent, next to the name written on the corresponding interface, no specific interface methods.
    interface
  4. The relationship between class and class (Relation) in UML class diagram, common are the following relations:
    (1) dependence; (2) is associated; (3) inheritance; (4) implementation; (5) polymerized; ( 6) a combination of
    the following is their representation:
    relationship
    (1) dependence
    as long as the other side is used in the class, then there dependencies between them. If there is no other, for Yi can not pass. Class A class is used if B, then A is dependent on B, not B, A compiler is not passed. Dependencies
    (2) relationship
    is actually a link between class and class relationships, dependency is a special case.
    Associated with navigation of: i.e., unidirectional or bidirectional relationship relationship
    relationship with multiplicities:
    "1" (indicating one and only one), "0
    ..." (indicating 0 or more),
    "0" (indicating 0 or a 1),
    "... m n" (n represents the number m can be),
    "m * ..." (indicates at least m).
    unidirectional
    Two-way
    (3) inheritance
    inheritance, also known as generalization, dependency is a special case. A class inherits from Class A Class B may also use the equivalent of a Class B.
    Here Insert Picture Description
    (4) Relationship implemented
    to achieve Class A relationship is actually implement the interface B, it is a special case of dependencies, dependency stronger.
    achieve
    (5) the relationship between the polymerization
    the polymerization is an integral relationship represented by the relationship and the portion integral with the part may be separated. Aggregation relationship is a special case of the relationship, so he has a navigational associated with multiplicity.
    polymerization
    Navigational: A B polymerized into
    multiplicity: B A-- a single polymerization polymerization; B which may aggregate a plurality of multiple polymerization A--
    (6) Relationship between composition
    Combination relationship: it is part of the overall relationship, but separated from whole and part not.
    Combination 1
    the Person class {public
    Private IDCard Card; // polymerization
    private Head head = new Head () ; // composition
    }
    public class IDCard {}
    public class Head {}
    1
    public class the Person {
    Private IDCard Card new new IDCard = (); // composition
    private head head = new head () ; // composition
    }
    public class IDCard {}
    public class head {}
    2
  5. Contact between the various relationships
    contact
    a brief introduction on these, their own learning is not particularly good, hoping to explore a little bit, and slowly progress.
Released three original articles · won praise 2 · Views 147

Guess you like

Origin blog.csdn.net/qq_43774908/article/details/104782007