09 package diagram

2,736 views 27 slides Oct 22, 2018
Slide 1
Slide 1 of 27
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27

About This Presentation

package diagram


Slide Content

UNIT I UML DIAGRAMS
Introduction to OOAD – Unified Process –
UML diagrams – Use Case – Class Diagrams–
Interaction Diagrams – State Diagrams –
Activity Diagrams –
Package, component and Deployment Diagrams.

Package Diagram
A diagram that shows packages of classes and
the dependencies among them

Introduction
–A UML construct that enables us to organize model elements, such as
classes, into groups.
–Namespace (i.e., all members should have unique names)
•Package diagram
–UML diagram which shows packages and dependencies b/w them.
•A dependency exists b/w 2 elements
.

Purpose of Package Diagram
•Create a package diagram to:
1.Depict a high-level overview of your requirements
2. Depict a high-level overview of your architecture/design
3.To logically modularize a complex diagram.
4.To organize programming source code.
•When to use a Package Diagram
–Used strictly for logical modularization
–When the application is very large
–Usually done in the design phase of a project

Notations - Package Representation
•Packages
–Represented as file folders
–Can contain other packages, creating hierarchy
Package org.hibernate
Members of the package may be shown
within the boundaries of the package
Package Types, some members
within the borders of the package

Package Representation
Members of the package may be
shown outside of the package

Notations - Element Visibility
•If an element that is owned by a package has visibility,
–It could be only public or private visibility.
(Protected or package visibility is not allowed)
•Visibility of a package element may be indicated by
–Preceding the name of the element by a visibility symbol
("+" for public and "-" for private)
All elements of Library Domain package
are public except for Account
Public elements of a package are always accessible
outside the package through the use of qualified names.

An element is owned by the package within which it is defined, but may be
referenced in other packages. In that case, the element name is qualified by
the package name using the pathname format PackageName::ElementName

Package Indication without Package Diagram

Relations
•Dependency
•Implementation
•Import / access
•Merge

Dependency
•Package A depends on package B
–if A contains a class which depends on a class in B
•Graphic representation:
There should be no cycles in the dependencies
Fish depends on water

Implementations
•Meaningful if multiple variants are present
•One element (client)
Implements the behavior that the other element (supplier) specifies.

Importing
•Importing means accessing the elements of source by target.
•Importing grants a one-way permission
–For the elements in one package to access the elements in another
package.
•If A’s package imports B’s package,
–A can now see B, although B cannot see A.

Import / access
•To understand the import / access relation b/w packages
–We need to know how elements can reference each other
–What does an element import / access mean
–How this notion can be generalized to packages

Fully Qualified Name
•Fully qualified name:
–A globally unique identifier of a package, class, attribute, method.
•Fully qualified name is composed of
–Qualifier (all names in the hierarchic sequence above the given element) &
–The name of the given element itself
•Fully Qualified Name Notation in UML
p::A::foo
p::r::C
Element can refer to other elements
That are in its own package without using
fully qualified names

Element Import / Access
•Element import allows
–An element in another package to be referenced using its name without
a qualifier
–<<import>>
imported element within importing package is public
–<<access>>
imported element within importing package is private

Example on Element Import / Access
Public import of PageInfo element from Domain package.
Private import of SortInfo element from Domain package.

Example on Element Import / Access

Example on Element Import / Access

Example on Element Import / Access

Example on Element Import / Access

Package Import
•A package import is a directed relationship
–That identifies a package whose members are to be imported
•A Package Import relationship
–Drawn from a source Package to a Package whose contents are to be
imported.
Private members of a target Package (Package2) cannot be imported.

Visibility of a Package Import
•Visibility of a Package Import
–Could be either public or private.
•Keyword «access» is shown to indicate private visibility.
Private import of Presentation package
Public import of Domain package.

Package Merge
•A package merge is a directed relationship b/w 2 packages
–That indicates that content of one package is extended by the contents of
another package.
–i.e., contents of the two packages are to be combined.
•Package merge is similar to generalization
–Source element conceptually adds the ch.s of target element to its own ch.s
resulting in an element that combines the characteristics of both

Package Merge
•Package merge can be viewed as an operation
–That takes the contents of two packages and produces a new package
that combines the contents of the packages involved in the merge.

Example on Package Merge
Tags