UML-package diagram

Source: Internet
Author: User

I. Meaning of the package chart

A package diagram consists of the relationship between a package and a package. It is important to maintain and control the overall structure of the system. In system modeling, there are a large number of classes, interfaces, components, nodes, and charts. It is necessary to group these elements and organize elements with similar semantics and changing tendency to join the same package, this makes it easy to understand and process the entire model.

A well-designed package is highly cohesive, low-coupling, and has strict control over its content access.

Ii. Package name

Each package must have a name different from other packages. The model package name is a string that can be divided into simple names and path names.

Simple name: the package contains only one simple name.

Path Name: prefix with the name of the peripheral package where the package is located.

3. Elements

1. A package can have classes, interfaces, components, nodes, collaboration, use cases, and diagrams. A package can even contain other packages.

2. The package forms a namespace, which means that each of the similar Modeling Elements in a model package cannot have the same name. Modeling of different model packages

The element can have the same name.

3. If the package is revoked, the elements in the package will also be revoked.

Iv. Package visibility

The package does not exist independently. The elements in the package are bound to external classes. The various packages in a good software model should be relatively high.

In order to achieve this, elements in the package need to be controlled so that some elements can be accessed by the outside world, while other elements do not

Visible. This is the visibility control of the elements in the package.

Package visibility is divided into three types:

1. Public Access: elements in the package can be accessed by any element in other packages that introduce this package. Public access is prefixed with the element name.

The plus sign (+) of the word.

2. Protected Access (protect): This element can be accessed by the element contained in the model package in the successor mode package on the inheritance relationship. Prefix for access protection to inclusion

The (#) Sign of the element name.

3. Private: indicates that this element can be accessed by an element contained in a package. Private access is prefixed with the minus sign of the element name.

.

V. Introduction and Output

Import: Allows elements in one package to access elements in another package in one way.

Output (export): contains elements with public access permissions in the package.

The package2 Package introduces package3, so the public element C1 in package3 is visible to the elements in package2, but the protection element C2 is not visible. Similarly, b1 is also visible to the elements in package1, but the private element-B2 is not visible. But it does not mean that the public elements in package3 are visible to the elements in package1. Package4 does not introduce any package, so the elements in other packages are invisible to the elements in package4.

Vi. Standard Elements

VII. Relationship between packages

There are two relationships between packages:

1. Introduction and access dependency: used to introduce the elements output by another package in one package.

2. generalization: similar to the generalization relationship of a class, the generalization relationship between packages follows the substitution principle. Special packages can be applied to any place where the general packages are used.

VIII. Packet Graph Modeling Technology

How to Create a package chart:

1. Analyze System Model Elements (usually object classes) and include model elements with similar concepts or semantics into a package.

2. For each package, mark its visibility into its model elements.

3. Determine the dependency between the package and the package, especially the input dependency.

4. Determine the generalization relationship between the package and the package, and determine the diversity and overloading of the package elements.

5. Draw a package chart

6. Refined package charts

 

Take the package diagram of the library management system as an example:

IDC charging system package diagram:

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.