Python design mode-UML-Package diagrams (Package Diagram)

Source: Internet
Author: User
Tags string format visibility

Brief introduction

Package diagrams is a description of the relationship between packages and packages, showing the dependencies between modules and modules in the system. A package diagram can consist of any UML diagram that can hold elements such as classes, interfaces, components, use cases, and other packages. A package is a very common element in UML, and the main function is to classify and accommodate other elements. The relationship between packages and packages is generalized, refined, and dependent, mainly depending on the relationships among the members within the package.

Package Diagrams Modeling Steps

-Analyze the model elements of the system, using layered design to include concepts, semantics, and logically similar elements in the same package

-For each package, analyze the accessible attributes of each element within the package, and identify the visibility of the element

-Determine the generalization, refinement, dependency between packages and the elements in the package, and handle overloads, multiplicity, and import relationships

-Analysis of package structure, refine of packages, merge and other operations

Elements in a package diagram

Package diagrams can hold many elements, such as classes, interfaces, components, annotations, and so on, which are involved in the corresponding UML diagrams, where the package elements are mainly described.

  • Package name Location : UML uses the folder icon to represent the package, the package name can be placed in the first column, can also be placed in the second column

put it in the first column .

Put it in the second column.

  • Package name format : Each package has a string format package name that uniquely identifies the package, where the package name is in two forms:

-Simple Package Name

-With Path package name

  • Visibility of

' + ': public: visible to all packages

'-': private: Not visible outside of this package

' # ': Protected: Visible to the child package of this package

  • transitivity : The relationship and visibility between packages and packages has transitivity

-Relationship passing: if there is a relationship between package A and package B, there is a relationship between package B and package C, then there is a relationship between package A and package C

-Visibility Delivery: Pass visibility based on the different dependencies between packages and packages

-<<import>> visibility can be passed because of the reason that it is added as a public element

-<<access>> visibility is not transitive due to add as private element reason visibility

  • Construction characteristics : Similar to the constructor of a class, that is, by adding <<xxx>> as a supplement to the package name keyword, UML provides 5 stereotypes to describe the characteristics of a package

-<<system>>: Indicates that the package represents a system

-<<subsystem>>: Indicates that the package represents a subsystem

-<<facade>>: Indicates that the package is a view made up of other packages

-<<stub>>: Indicates that the package is a proxy package that provides public services for other packages

-<<framework>>: Indicates that the package represents a framework

The relationship of package diagrams class

  • generalization : The inheritance relationship, similar to the generalization relationship between classes, indicates a package family
  • Refinement : One package has all the elements in another package, then the second package is the refinement of the first package
  • Dependency : One package is referenced to another package, the arrow points from the input package to the output party package

<<use>>: A default package dependency that represents the elements in a client package that use common elements in a provider package in some way

<<import>>: The most common package dependency, which means that the public element in the provider package is added as a common element in the customer package

<<access>>: Indicates that the public element in the provider package is added as a private element in the customer package

<<merge>>: Indicates that the elements in the provider package are extended to elements in the customer package

<<trace>>: Indicates that the historical version of a package has evolved into an evolutionary version of another package

Advanced features of package diagrams

  • layering : Based on the hierarchy of responsibilities, the purpose is to understand decoupling. Two-way arrows indicate interdependence.

  • nested : Inside the package can have a package. However, you should try to avoid the use of multi-layer nested package, 2-3-storey.

Package diagram example

Take the bookstore online ordering system as an example

Package Diagrams Precautions

-If the package is revoked, then the elements will be removed

-Reasonable minimization of dependencies between packages

-Reasonable minimization of public in each package, number of protected elements and maximum number of private elements

-Avoid cyclic dependencies between packages

-Layering, grouping, merging, refining packages based on dependency between classes

-The relationship between packages follows high cohesion, low-coupling characteristics

Python design mode-UML-Package diagrams (Package Diagram)

Related Article

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: 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.