0.5.8 Activity Partitions and Swimlanes

Sometimes You Need to Show Who Is Responsible for Each Action

A normal UML activity diagram can show:

A web interaction introduces another useful question:

Which system performs each action?

For example:

A UML activity diagram can make those responsibilities visible using activity partitions, often called swimlanes.

A Swimlane Groups Actions by Responsibility

Imagine two vertical lanes:

Plain text
Browser              Server
-------              ------

Actions performed by the browser appear in the Browser lane.

Actions performed by the server appear in the Server lane.

A simplified web interaction might look conceptually like:

Plain text
Browser                     Server
-------                     ------
Start
  |
Create request
  |
  |------------------------>
                            Receive request
                            Process request
                            Create response
  <------------------------|
Receive response
  |
Display page
  |
End

The arrows can cross lane boundaries.

That crossing is useful because it shows information or control moving from one responsible participant to another.

Partitions Do Not Mean Separate Programs Must Be Drawn Independently

The diagram still represents one overall activity.

The partitions organize responsibility within that activity.

The Browser and Server lanes are not two unrelated diagrams.

They are two participants in one process.

Put Each Action in the Lane of the Performer

Suppose the action is:

Plain text
Create web request

That belongs in the Browser lane.

Suppose the action is:

Plain text
Process requested path

That belongs in the Server lane.

Suppose the action is:

Plain text
Render returned HTML

That belongs in the Browser lane.

The placement communicates meaning.

If an action is placed in the wrong partition, the diagram tells the reader that the wrong participant is responsible.

Cross-Lane Flow Shows Handoffs

A web request crosses from client to server.

A response crosses back.

That can be represented visually:

Plain text
Browser                        Server

Send request  --------------> Receive request

Receive response <----------- Send response

Those crossings are some of the most informative parts of the model.

They show where responsibility moves between systems.

Keep Actions Separate From Messages

An action might be:

Plain text
Send request

The request itself is the information being communicated.

Likewise:

Plain text
Send response

is an action.

The response is the information being sent.

At this introductory level, the activity diagram focuses primarily on actions and flow rather than trying to model every protocol field inside the message.

Use Partitions Only When Responsibility Matters

A swimlane diagram adds information.

It also adds visual structure.

If every action belongs to the same participant, partitions may not help.

They are especially useful for web interactions because client and server responsibilities are central to the concept.

A Soccer Website Example

Imagine a browser visiting a soccer club page.

The Browser lane might contain:

The Server lane might contain:

The same process without lanes can show order.

The lanes add:

Who does each step?

Read Across the Lanes

When reading a partitioned activity diagram:

  1. Find the start node.
  2. Identify which lane contains the first action.
  3. Follow the flow.
  4. Notice every time the arrow crosses into another lane.
  5. Ask what responsibility changed at that handoff.
  6. Continue until the end node.

Do not read one complete lane top-to-bottom and then move to the next.

Follow the arrows through the process.

Partitions Can Represent More Than Computers

A partition can represent a:

In this module, the most useful partitions are:

Later diagrams may use partitions when other responsibility boundaries matter.

The Main Purpose

An activity diagram already answers:

What happens next?

Partitions add:

Who is responsible for what happens next?

That makes them a strong fit for modeling a web request and response.