[Object Oriented Design Basics] a beginner in the unified UML modeling language

Source: Internet
Author: User

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

1. UML is a tool launched by Object Management Group to simplify complex software engineering processes. with UML, you can customize and Visualize Software and non-software design. Note that UML is only a modeling language. It only defines words and grammar, but does not define the modeling process or process.

2. The classification of static and dynamic models mentioned above can also be as follows:

Structure diagrams: can be used to represent the structure of an application.

  • Class Diagrams
  • Object diagrams
  • Component Diagrams
  • Deployment Diagrams

Behavior diagrams: can be used to represent the behavior of an application:

  • Use Case Diagrams
  • Sequence Diagrams
  • Activity Diagrams
  • Collaboration diagrams
  • Statechart Diagram

Model Management diagrams: it can be used to represent how different program modules are organized and managed:

  • Packages
  • Subsystems
  • Models

This article only describes the class diagram and sequence diagram in detail.

3. Class Diagram details:

1) Composition Form:

For example:

2) internal class:

We use the following method to represent the internal class, which is defined in the method area.

For example:

3) Access descriptor:

For Java, we use the following symbol to represent the access descriptor:

Some permission settings for each access descriptor are described in detail:

4) abstract classes and methods:

A method defined in a class without a body is called an abstract method. At least one class of the abstract method is an abstract class. Description in italics:

5) exception:

Use dotted lines and arrows to indicate:

 

6) Note (including restrictions, comments, and code explanations ):

Only use the box of dog-eared:

 

7) Generalization: describes an inheritance relationship.

 

8) interface:

Similar to class representation. Add <>,

9) Implementation:

This is the interface description and implementation method. There are two Representation Methods:

Or:

 

10) Dependency:

There is a dependency between the description source and the target component. That is to say, once the target is changed, the source must be changed, rather than vice versa. See the example below.


The Order class uses the execute method of the dbutil class to call SQL statements. Therefore, the Order class depends on dbutil (dbutil is target)

 

11) class association:

Multiple (Multiplicity), Modifier implies the relationship between instances. Some instances of a class are related to instances of another class and are symbols that indicate multiple types:

There are three types below:

A) navigability: When a contains the required information that reaches B, that is, a knows B, but B does not know. For example:

A loggerbridge class instance is contained in log‑action.

Of course, this may also be two-way,

B) Composition: Class A contains Class B

This chart has two meanings:

A line item is part of an order.

A line item cannot exist without an order.

 

C) aggregation: aggregation, which is more lightweight than B,

This graph has two meanings:
A player is part of a team.

A player can be part of more than one team and hence, when a team
Is dissolved, the player still remains.

 

4. Sequence diagram details:

1) Sequence Graph object: represented by the colon of the type and its front side:

2) message:

In general, messages are mapped to class operations. If they are not interacting with classes, such as operations between a user and an ATM, therefore, it is inappropriate to directly use such a message. A message can also represent a business workflow.

3) Self-call:
A message in which a Sequence Graph object acts on itself,

 

Here is an example of a comprehensive sequence chart:

A user enters the registry form online. All submitted information is received by the Controller object first. The controller creates an object account and stores the information to the account object, create an account object and use dbmanager to save the data to the database (use self-call ).

 

Author: gnuhpc
Source: http://www.cnblogs.com/gnuhpc/

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.