SE450: Packages: Package Diagrams [8/47] |
A top-level package diagram typically shows all of the packages in a system. Sometimes it also includes the public classes/interfaces within each package (usually by name only--no fields or methods listed). You can then show the dependencies between these public portions of the packages.
Here is a small example:
+---+ +---+ | x | | y | +---+-------------+ +---+-------------+ | | | | | +-------------+ | | +-------------+ | | |<<interface>>|<----+-------|Main | | | | I | | | | +-------------+ | | +-------------+ | | | | | | | +-----------------+ | +----------+ | | | |<<static>>|<------+ | | IFactory | | | +----------+ | | | +-----------------+
There are two packages, x
and y
.
x
has two public classes: I
is an
interface and IFactory
has only static methods.
y
has one public class: Main
.
y.Main
depends on x.I
and
x.IFactory
.
Note that the diagram does not show "intra-package" dependencies, only "inter-package" dependencies; that is, we do not show dependencies within a package, but only between packages.
Here is a more abstract version:
+---+ +---+ | x | | y | +---+---+ +---+---+ | | | | | |<--------| | | | | | +-------+ +-------+
A system document would usually also have a class diagram for each package, showing in more detail how the package is implemented.