Start Diagramming!

<- Previous

5j. UML Elements - Package and Model

Finally, let's talk about the organizing elements of UML: the "Package" and "Model" elements.

What is a Package?

"Packages provide the main generic structuring and organizing capability of UML."

A Package is used to organize and group together Classes, Interfaces, DataTypes, etc. into a single unit. Packages have the ability to even group other Packages.

Packages are generally not depicted in Class Diagrams. They are mostly depicted in Package Diagrams to show dependencies between Packages or how Packages are merged or imported. However, it's important to understand that when you create a Class Diagram, you essentially are building all of the components of a Package.

What is a Model?

"A Model is a description of a system, where 'system' is meant in the broadest sense and may include not only software and hardware but organizations and processes..."

A Model is a subclass of a Package and does all of the things that a Package can do. In other words it contains and groups together Classes, Interfaces, DataTypes, other Packages or Models, etc.

What makes a Model different than a Package is that it's considered to be "complete."

Packages and Models as a "Namespace"

"Packages...are Namespaces whose specific purpose is to contain other NamedElements in order to organize a model"

One of the key purposes of a Package or Model is to group other elements together and make them available via their "name" by acting as a "Namespace". All this menas is that when you want to access an element, you go to the Package or Model which contains it.

Comparison to Object-Oriented Programming Languages

Many object-oriented Programming Languages have the concept of packages, but the definition and purposes varies by language.

Packages are most alike to langagues that use the "package" keyword or the "namespace" keyword.

Abstract Syntax

To illustrate what a Package is, UML provides abstract syntax which we have recreated in UML Class Diagrams.

Package and Model Abstract Syntax
Package and Model Abstract Syntax
Package Abstract Syntax Inherited Attributes
Package Abstract Syntax Inherited Attributes
Package Abstract Syntax Inherited Operations
Package Abstract Syntax Inherited Operations
Model Abstract Syntax Inherited Attributes
Model Abstract Syntax Inherited Attributes
Model Abstract Syntax Inherited Operations
Model Abstract Syntax Inherited Operations

Next ->