next up previous contents
Next: Package Classes: Example Up: Lecture 2: Classes, Objects, Previous: Packages: Example

Commentary

Semantically related grouping of classes, interfaces, components, nodes, diagrams, etc. No instantiation of a package. Packages related by dependency, refinement, or generalisation. Visibility of package elements from outside a package can be controlled. Package contents are owned by the package, and cannot be in another package. Package name unique: simple or path name (showing packages containing it) with optional tags, e.g., Client::OrderForm (fully qualified name of the element OrderForm in the package Client). Elements of one package can be imported by another package by referring to the package containing it. Package contents are like composite aggregates of the package. Different kinds of elements in a package can have the same name. Contents of another package is imported by reference: shared aggregation; components belonging to one package used by another by sharing. Visibility defaults to public being accessible from another package element provide the latter imports it. Private elements not visible outside the package. Visibility symbols: +:public, -:private, #:protected. Friend package can import and access everything from another package. <<import>> stereotype adorns the dependency relationship (dashed line with arrow, the arrow pointing to the package imported). Import requires no qualified name, the source name space being visible to the importer. However, to avoid name clash qualified name is used. <<access>> is a similar stereotype which allows importation but always requires qualified name. The public parts of a package are visible only to the contents of the package. They are called its exports. To use them outside a package they must be imported by the user. Both import and access are not transitive. If A imports B and B imports C, it does not follow that C is imported by A. Packages may be contained in other packages - nesting. All elements visible in a package are visible from packages nested in it. No import is necessary. Generalisation/ specialisation relationship between packages form super-package, sub-package hierarchy. Protected elements of a package accessible by importing only from its sub-packages. A sub-package may be used wherever its super-package is used.

5 Standard package stereotypes:

1.
facade: Package which is aview of another package.
2.
framework: Package of patterns.
3.
stub: Package that serves as a proxy for the public contents of another package.
4.
subsystem: Package that forms an independent part of a bigger system
5.
system: Package that represents the whole system.


next up previous contents
Next: Package Classes: Example Up: Lecture 2: Classes, Objects, Previous: Packages: Example
Ananda Amatya
11/3/1999