UML-package diagram

Source: Internet
Author: User

Speaking of the package diagram, let's take a look at the package


1. What is a package?


A package can be directly understood as a namespace and folder, which is used to organize the encapsulation of graphics.


2. What is the role of the package?

    • Logically modularize a complex Graph
    • OrganizationSource code

3. When will the package be used?


From the perspective of object-oriented software development, classes are the basic construction blocks for building the entire system. However, for a large application system, there will be hundreds of classes. In addition to the associations and multiple features in the system, the complexity must be greatly exceeded. This introduces the block of grouping transactions such as "package.


4. Package name


Each package must have a name different from other packages.


5. Package symbols


6. elements in the package

A package can contain a variety of other elements, including classes, interfaces, components, nodes, collaboration, use cases, and even other packages or diagrams.

Note: If the package is unwrapped, the elements in the package are also removed.


7. Package visibility


    • "+" Is used to indicate "public", which is visible to all packages.
    • "#" Is used to represent "protected". Only the sub-packages of this package can be visible.
    • "-" Is used to indicate "private", which is invisible to outsourcing.

8. Principle of creating a package chart
 

    • Minimize dependencies between packages, minimize the number of public and protected elements in each package, and maximize the number of private elements in each package.
    • During modeling, circular dependencies between packages should be avoided, that is, mutual dependencies cannot be included. In this case, analysis should be performed:
    • The unit of test should be package
    • Try to include similar elements in a package.

9. Relationship between packages

    • Dependency: changes to the definition of one element may cause changes to another element. The dependency relationship of the package is also indicated by a dotted line. The dotted line arrow points from the dependency package to the dependent package.

Note: The package marked with {Global} is a universal package, indicating that all other packages in the system depend on this package.

    • Generalization: express the general and special relationships between things. If there is a general relationship between the two packages, it means that the special packages must follow the interface of the general package. {Abstract} indicates that it defines an Interface

10. Use the UML package diagram

    • Modeling Group Elements
    1. Each package should be composed of elements that are close to each other in terms of concept and semantics;
    2. Find elements that should be marked as public for each package, but should be as few as possible;
    3. Generally, the default "use" constructor is used to clarify the "import" constructor when ing to programming;
    4. Consider using generalization to model special packages.
    5. When expressing this model, note that only the elements that play a core role on each package are marked. In addition, you can also identify the document tag value of each package to make it clearer.
    • Architecture Modeling

Modeling the architecture (ProgramHierarchical) is a more meaningful use of the UML package diagram. Architecture is the core logical structure of a software system.

Common architecture modes include hierarchy, MVC, pipeline, blackboard, and microkernel. In application software, hierarchy and MVC
 

A package chart is a tool that keeps the system architecture concise and clear. So, if you cannot compress the class image of the entire system to an A4 paper, you should use the 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.