UML Package Diagram

When modeling a large scale system, you would probably be working with a high volume of model elements. They describe a model from different views and different phases, hence are in different types. UML package helps to organize and arrange model elements and diagrams into logical groups, through which you can manage a chunk of project data together. You can also use packages to present different views of the system's architecture. In addition, developers can use package to model the physical package or namespace structure of the application to build. With this, they follow the convention of naming package like using lower case for Java package.

July 6, 2011
User Rating: / 59
Views: 129,927
PDF Link Add comments
Edition: Community or above (Edition comparison)

Package diagram visualizes packages and depicts the dependency, import, access, generalization, realization and merge relationships between them. Package diagram enables you to gain a high level understanding of the collaboration among model elements through analyzing the relationships among their parent package. This also helps explain the system's architecture from a broad view.

package diagram overview

Here are some of the notations you can use in package diagram.

Notation Description
Package Represents a group of model elements and/or diagrams.
Subsystem A system that is part of a large scale system.
Dependency When a package (e.g. client) requires another (e.g. supplier) for specification or implementation, a dependency would be established to model that. Dependency can also be found among model elements contained in packages.
Import A relationship that shows the model elements in a package which are to be imported from another package. It allows a package to refer to a model element in another package without qualification.
Access Model elements in a package that can be used by the model elements in another package but cannot be further imported from that package.
Generalization A relationship that shows a package inheriting from another by sharing its properties and adding its own properties to produce a package with more specific specification.
Realization An abstraction relationship between two packages showing that the supplier package provides specification while the client package implements it.
Merge A relationship between two packages showing that their contents are to be combined. This should be used when elements in packages have the same name and represent the same concept.

In this tutorial, we'll use Visual Paradigm to model a simple system with several UML classes in it. We are going to create packages and move the classes into them. We'll also draw package diagram to show the relationships between packages.

Before starting this tutorial, you may want to familiarize yourself with the following resources.

  1. Unified Modeling Language (UML) Specification (ref: 7.3.38 Package (from Kernel) in OMG Unified Modeling Language Superstructure Version 2.4)
  2. Users Guide - Resource centric interface

Drawing a Simple Class Diagram

Since we are using package with classes in the following example, let's begin by creating a few classes.

Note: In practice, you may use package with any type of model elements. There is no special requirement.

  1. Start Visual Paradigm.
  2. Create a new project by selecting File > New Project from the main menu.
  3. In the New Project window, name the project Package Diagram Tutorial. Click Create Blank Project.
  4. In the Diagram Navigator, right click on Class Diagram and select New Class Diagram from the popup menu.
    new class diagram
  5. Make use of the diagram toolbar and resource-centric interface to draw a class diagram like this:
    simple class diagram
    Note that the relationship between Shape, Triangle and Ellipse classes is generalization. The relationship between Shape and Color classes is dependency.

Creating Packages in Model Explorer

We now have four classes. Shape, Triangle and Ellipse belong to model, while Color is a type, required by the Shape class. In this section, we'll create two packages to group the four classes. There are many possible ways for you to create packages. One way is to create them directly in a class diagram containing the classes. In this tutorial, we'll try something different - creating package in the Model Explorer.

  1. Open the Model Explorer, which is the tab next to that of the Diagram Navigator.
    open model explorer
  2. Right click at the project root node and select Model Element > Package from the popup menu.
    new package
  3. In the Package Specification window, name the package Domain Model and click OK.
  4. Create another package Type.
    updated model explorer

Moving Classes into Packages

You can move model elements into a package through the Model Explorer via simple drag-and-drop. In this section, we'll move the classes into the appropriate packages.

  1. Select the classes Shape, Ellipse and Triangle. You can perform multiple selections by pressing the Ctrl key.
    sel classes
  2. Drag the selected class into the package Domain Model.
    drag classes into package
  3. Click Yes to confirm moving classes.
  4. Similarly, drag the class Color into package Type. This forms a hierarchy.
    hierarchy formed

Drawing Package Diagram

Now, you can draw a package diagram to show the relationships among the classes from a high-level view, through modeling with their parent packages.

  1. Go back to the Diagram Navigator.
  2. Right click on Package Diagram and select New Package Diagram from the popup menu.
    new package diagram
  3. Open the Model Explorer.
  4. Select the two packages. Again, press the Ctrl key for multiple selections.
    select packages
  5. Drag the selected packages onto the package diagram just created. Release the mouse button. You should obtain a diagram similar as below:
    package diagram
  6. You know that the Shape class in Domain Model depends on the Color class in Type. Therefore, add a dependency between the parent packages to represent this fact. Move the mouse pointer over the package Domain Model. Press on the resource icon Dependency -> Package and drag to the package Type.
    create dep
  7. Release the mouse button within Type. The diagram should now become:
    result package diagram

Related Links

  1. YouTube Video: Package Diagram in UML
  2. Know-how: Organize Project Data with Model


  1. Package Diagram Tutorial.vpp

Rate this Article

Click on one of the stars below to rate this article from 1 (lowest) to 5 (highest).

You may be interested in

  1. Data Flow Diagram (DFD) Tutorial
  2. Writing Effective Use Case
  3. Share Design, Discuss Design with PostMania
  4. Draw Entity Relationship Diagram (ERD)
  5. Generate Class Diagram from Entity Relationship Diagram (ERD)
Tags of this article:

Comments (10)

written by tina on November 15, 2010

i have three packages"geometry, extent and relations". now i want to use these packages inside one package.. so i added all three packages inside a package but it do't make relation between them.. kindly help me in this regard..

written by tina on November 15, 2010

kindly provide a forums link in this website so that people can ask any question related to UML design and also provide chat room related to UML so that people can discuss there points and infact clear their problems..

written by Trevor Rose on June 9, 2011

This tutorial isn't all that useful, for the particular reason that it describes how to do something, without even remotely touching on WHY we are doing it and WHAT the result or influence of our actions are... if this is a typical example of your tutorials, then they are of little use to anyone, and you might as well remove them if you arent going to do them properly... they certainly wont be positively influencing your sales in any way i can guarantee you that (as someone who has sold software)

written by Jick Yeung on July 7, 2011

Hi Trevor Rose,

Thank you for your opinion. We have rewritten this page. The information is now more relevant. We will also review and correct the other pages.

Best regards,
Jick Yeung

written by Alex on September 22, 2011

Hi, why don't you consider doing short videos. I have gone through the tutorial above, twice now and can't see the point. In fact the software looks cumbersome the way it is presented, ie no clear drag and drop pallet. I am sure it is, but it just does not come across well

written by Jick Yeung on September 30, 2011

Dear Alex,

Thank you for your suggestion. We have prepared a video for this tutorial. Please watch at:

Best regards,
Jick Yeung

written by Nynat on October 25, 2012

However, please include another basic step in this tutorial by adding the attributes of the classes, thou the tutorial centers around packaging classes, but you can better package it you know the characteristic of what you are packaging.

Two packages: set A=three elements and B= 1element, with out attributes, thou it is implement.

written by arpit & shivam on July 1, 2014

we r hopping a lot but we r nt satisfy yet.........

written by 陳 富華 on July 2, 2014

Thanks for your comment. We will do my best to improve the quality.

written by 陳 富華 on July 2, 2014

Thanks for your comment. We will do my best to improve the quality.

Write comment



Enter the calculation result

security code