The Agile Modeling (AM) Method

UML Package Diagrams: Diagramming Guidelines

UML package diagrams are composed only of packages and the dependencies between them. A package is a UML construct that enables you to organize model elements, such as use cases or classes, into groups. Packages are depicted as file folders and can be applied on any UML diagram. Create a package diagram to:

There are guidelines for:

  1. Class Package Diagrams
  2. Use Case Package Diagrams
  3. Packages

 

1. Class Package Diagrams

Figure 1. A class package diagram.

UML package diagram

  1. Create UML Component Diagrams to Physically Organize Your Design.
  2. Place Subpackages Below Parent Packages.
  3. Vertically Layer Class Package Diagrams.
  4. Create Class Package Diagrams to Logically Organize Your Design. Figure 1depicts a UML Class diagram organized into packages. In addition to the package guidelines presented below, apply the following heuristics to organize UML Class diagrams into package diagrams:
  • Place the classes of a framework in the same package.
  • Classes in the same inheritance hierarchy typically belong in the same package.
  • Classes related to one another via aggregation or composition often belong in the same package.
  • Classes that collaborate with each other a lot, information that is reflected by your UML Sequence diagrams and UML Collaboration diagrams, often belong in the same package.

 

2. Use Case Package Diagrams

Use cases are often a primary requirement artifact in object-oriented development methodologies, this is particularly true of instantiations of the Unified Process, and for larger initiatives package diagrams are often created to organize these usage requirements.

Figure 2. A UML Use Case diagram comprised mostly of packages.

UML package diagram

  1. Create Use Case Package Diagrams to Organize Your Requirements
  2. Include Actors on Use Case Package Diagrams
  3. Horizontally Arrange Use Case Package Diagrams

3. Packages

The advice presented in this section is applicable to the application of packages on any UML diagram, not just package diagrams.

  1. Give Packages Simple, Descriptive Names
  2. Apply Packages to Simplify Diagrams
  3. Packages Should be Cohesive
  4. Indicate Architectural Layers With Stereotypes on Packages
  5. Avoid Cyclic Dependencies Between Packages
  6. Package Dependencies Should Reflect Internal Relationships

Recommended Reading

Modeling style: Elements of UML 2.0 Style The Elements of UML 2.0 Style describes a collection of standards, conventions, and guidelines for creating effective UML diagrams. They are sound, proven strategies that lead to diagrams that are easier to understand and work with. These conventions exist as a collection of simple, concise guidelines that if applied consistently, represent an important first step in increasing your productivity as a modeler. This book is oriented towards intermediate to advanced UML modelers. Although there are numerous examples throughout the book it would not be a good way to learn the UML (instead, consider The Object Primer). The book is 188 pages long and is conveniently pocket-sized so it’s easy to carry around.
Choose Your WoW! 2nd Edition This book, Choose Your WoW! A Disciplined Agile Approach to Optimizing Your Way of Working (WoW) – Second Edition, is an indispensable guide for agile coaches and practitioners. It overviews key aspects of the Disciplined Agile® (DA™) tool kit. Hundreds of organizations around the world have already benefited from DA, which is the only comprehensive tool kit available for guidance on building high-performance agile teams and optimizing your WoW. As a hybrid of the leading agile, lean, and traditional approaches, DA provides hundreds of strategies to help you make better decisions within your agile teams, balancing self-organization with the realities and constraints of your unique enterprise context.
The Object Primer 3rd Edition: Agile Model Driven Development (AMDD) with UML 2 The Object Primer 3rd Edition: Agile Model Driven Development with UML 2 is an important reference book for agile modelers, describing how to develop 35 types of agile models including all 13 UML 2 diagrams. Furthermore, this book describes the fundamental programming and testing techniques for successful agile solution delivery. The book also shows how to move from your agile models to source code, how to succeed at implementation techniques such as refactoring and test-driven development(TDD). The Object Primer also includes a chapter overviewing the critical database development techniques (database refactoringobject/relational mappinglegacy analysis, and database access coding) from my award-winning Agile Database Techniques book.