SHEET SET — GROUPING CONSTRUCTS

Grouping Constructs

The Class — the smallest grouping construct

The class itself is already an act of grouping: it bundles a set of attributes and operations that belong to one concept, and draws a boundary.

Invoice - number : String - issuedOn : Date - lineItems : List<Item> - status : Status + addItem(item) + total() : Money + markPaid() attributes + operations, grouped by concept
FIG 01.1 Class compartments notation: UML class box
02

Package — grouping classes into a namespace

«package»

A package is UML's general-purpose grouping construct. It collects related classes, interfaces, and even other packages under one name, and that name becomes a namespace — two classes in different packages can share a simple name without colliding.

billing Invoice Payment customer Customer «import» dashed arrow = dependency between packages
FIG 02.1 Package with import dependency notation: folder-tab box
03

Subsystem — a package that also does something

«subsystem»

A subsystem is a package stereotype with teeth: besides grouping elements, it declares behavior — it offers interfaces to the rest of the system .

«subsystem» PaymentProcessing CardGateway FraudCheck Ledger IPay
FIG 03.1 Subsystem realizing an interface notation: stereotyped package + lollipop
04

Component — grouping for replaceability

«component»

A component groups classes into a unit meant to be swapped as a whole: a compiled module, a service, a library. It contains and more by the ports and interfaces to connect to external world.

«component» SearchIndex Tokenizer RankScorer ShardWriter ISearch IStorage
FIG 04.1 Component with ports notation: box + provided/required interfaces
=