Package Diagram: Lab Lect#15 31/7/2020
Package Diagram: Lab Lect#15 31/7/2020
Package Diagram: Lab Lect#15 31/7/2020
DIAGRAM
LAB LECT#15
31/7/2020
PACKAGE DIAGRAM
1. The name of packages should be unique within a system. However, it is allowed for
classes inside different packages to have same name. For Example, Package::Product &
Shipping::Product are allowed.
2. Users should avoid using package name delivered by the programming language. For
Example, Java provides Date as a package. So, programmers should construct package
with name Date.
3. Packages can include whole diagrams, name of components alone or no components
at all.
A PACKAGE CAN ALSO HAS A FULLY QUALIFIED NAME
CONT…
Note That:
◼ UML, C++, Perl, Ruby myPkg::foo::bar
◼ Java, C# myPkg.foo.bar
PACKAGE CONTAINMENT
The UML does not treat package diagrams as a separate technique, It is often useful to combine them by
grouping other model elements together into different packages on the same diagram.
Package diagrams can be useful in many ways, such as:
◼ To create an overview of a large set of model elements
◼ To organize a large model
◼ To group related elements
◼ To separate namespaces
CRITERIA FOR DECOMPOSING A SYSTEM INTO PACKAGES
Example:
◼ Track Order Service for an online shopping store:
◼ Track Order Service is responsible for providing tracking information for the products
ordered by customers. Customer types in the tracking serial number, Track Order
Service refers the system and updates the current shipping status to the customer.
STEP-1: IDENTIFY THE PACKAGES PRESENT IN THE SYSTEM
◼ There is a "track order" service, it has to talk with other module to know about the
order details, let us call it "Order Processing".
◼ Next after fetching Order Details it has to know about shipping details, let us call that
as "Shipping".
◼ Finally if knows the status of the order it has to update the information to the user, let
us call this module as "UI Framework".
CONT…
STEP 2 - IDENTIFY THE DEPENDENCIES
(i). "Track order" package should get order details from "Order Processing" and on
the other hand, "Order Processing" also requires the tracking information from the
"Track Order" package, thus, the two modules are accessing each other which suffices
<<access>> dual dependency.
CONT…
CONT…
(ii). To know shipping information, "Shipping" requires to import "Track Order" to complete the shipping
process.
STEP 3 - FINALLY, TRACK ORDER DEPENDENCY TO UI FRAMEWORK IS
ALSO MAPPED IN TO THE DIAGRAM WHICH COMPLETES THE PACKAGE
DIAGRAM FOR TRACK ORDER SUBSYSTEM.
PACKAGE DIAGRAM EXAMPLE MVC STRUCTURE