Notes on "Java Design Patterns"-Chapter 2 UML Quick Introduction

statement:

This blog is my notes after studying "Java Design Patterns". It is intended to facilitate review and review, and is not for commercial use.

This blog has indicated the source, if there is any infringement, please inform and delete it immediately.

1. UML definition

  • Unified Modeling Language (English: Unified Modeling Language, abbreviated UML)
  • Non-patent third-generation modeling and specification language

2. UML Features

  • UML is a development method

  • A development method used to illustrate, visualize, construct, and write an object-oriented, software-intensive system product under development.

  • UML demonstrates a series of best engineering practices

    These best practices have been proven effective in modeling large-scale and complex systems, especially at the software architecture level

3. UML2.2 Classification

A total of 14 icons are defined in UML2.2, which are classified as follows:

  • Structural graphics: Emphasis is on systematic modeling
  • Behavioral graphics: Emphasize the events triggered in the system model
  • Interactive graphics: Belongs to the behavioral graphics sub-collection, emphasizing the data flow in the system model.

Structural graphics:

  • Static diagram (class diagram, object diagram, package diagram)
  • Implementation diagram (component diagram, deployment diagram)
  • Section view
  • Composite structure diagram

Behavioral graphics:

  • Activity diagram
  • State diagram
  • Use case diagram

Interactive graphics:

  • Communication diagram
  • Interactive overview diagram (UML2.0)
  • Timing diagram (UML2.0)
  • Time chart (UML2.0)

4. UML class diagram

  • Class Diagram: used to represent the static relationship between classes, interfaces, instances, etc.
  • Although the name is a class diagram, the class diagram is not just a class, including permissions, attributes, methods, etc.

4.1 Arrow direction

UML arrow direction: from the child class to the parent class

4.2 Solid line-inheritance|dotted line-implementation

Insert picture description here

  • Hollow triangle arrow: inheritance or realization
  • The solid line-inheritance, is a relationship, the purpose of expansion, is not imaginary, very strong.
  • Dotted line-realization, the dotted line represents the "virtual" no entity.

4.3 Solid line-association|dotted line-dependence

Insert picture description here

  • Solid line-association relationship: stable relationship, real relationship, iron buddies.
  • Indicates that a class object is related to another class object
  • Usually one class has another class object as an attribute

Insert picture description here

  • Dotted line-dependency: use it temporarily, if it is separated, illusory, if there is no
  • Represents a kind of usage relationship, one class needs to use another class to realize the function
  • Generally, one class uses another class as a parameter or as a return value

4.4 Hollow diamond-aggregation|solid diamond-combination

Insert picture description here

  • The relationship between the whole and the part has an independent life cycle, which is the relationship of has a
  • Weak relationship
  • Negative words: weak-empty

Insert picture description here

  • The relationship between the whole and the part is stronger than that of aggregation

    Both have the same life cycle, the relationship of contains-a

  • Strong relationship

  • Positive words: strong-full

Common number expressions and meanings, assuming there are A and B types, the numbers are marked on the A side:

  • 0…1: 0 or 1 instance
  • 0…*: 0 or more instances
  • 1…1: 1 instance
  • 1: There can only be 1 instance
  • 1...*: At least 1 instance

5. UML timing diagram

  • Sequence Diagram: is a diagram showing the interaction between objects, these objects are arranged in chronological order .
  • The main modeling elements included in the sequence diagram are:
    • Object (Actor)
    • Lifeline
    • Focus of control
    • Message

Insert picture description here

6. Explanation of UML Class Diagram

Insert picture description here

The UML class diagram is divided into three parts:

  • The name of the class
    • Ordinary class: GeelyClass
    • Abstract class (in italics): GeelyClass
    • Interface (indicated by angle brackets): << interface >>
  • The attribute of the class, the symbol in front of the attribute indicates the access modifier
    • +:public
    • -:private
    • #:protected
    • ~:default
    • Underscore: static
  • Class behavior

7. UML class diagram explanation-top-down

Insert picture description here

Guess you like

Origin blog.csdn.net/bm1998/article/details/112847589