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.
put it in the first column .
Put it in the second column.
-Simple Package Name
-With Path package name
' + ': public: visible to all packages
'-': private: Not visible outside of this package
' # ': Protected: Visible to the child package of this package
-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
-<<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
<<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.
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)