22
UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Embed Size (px)

Citation preview

Page 1: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML-2 Changes

CSE301

University of Sunderland

Harry R Erwin, PhD

Page 2: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Resources

• Eriksson, H-E., et al., 2004, UML 2 Toolkit, OMG Press, Wiley.

• Pilone, D., with Neil Pitman, 2005, UML 2.0 in a Nutshell, O’Reilly.

• http://www.uml.org/ • http://www.agilemodeling.com/ • http://en.wikipedia.org/wiki/Unified_Modeling_Lan

guage

• http://www.eclipse.org/modeling/mdt/?project=uml2

Page 3: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Major Changes in UML 2

• Use Cases

• Activity Diagrams

• State Machine Diagrams

• Sequence Diagrams

• Communication Diagrams

• Interaction Overview Diagrams

• Timing Diagrams

Page 4: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

A UML 2 Use-Case Diagram

Personnel

Intelligence

Operations

Logistics

Commander CoS

G1 Section

G2 Section

G3 Section

G4 Section

Page 5: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

More Details in Use Cases

General Case<<extension points>>

Detailed case

Direction of the interaction

ActorGeneralization

Use CaseGeneralization

IncludedUse Case

<<include>>

Extension case

<<extend>>

Page 6: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Use Case Details

• Description still usually textual.• Use cases are initiated by actors and provide value

to them.• Use cases should be complete.• Use activity diagrams to clarify the flow.• Use cases can be:

– Generalized (new)– Extended– Included (was ‘used’)

Page 7: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

New UML 2 Class Diagrams<<entity>>

An EntityClass

<<boundary>>

A BoundaryClass

<<control>>

A ControlClass

An EntityClass

A BoundaryClass

A ControlClass

AnEntityClass

AControlClass

ABoundaryClass

Page 8: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Interfaces and Ports

Storable

Runnable

Runnable

InterfaceProvided

RequiredInterface

Port

Page 9: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Diagramming Composite Structures

Page 10: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Collaboration Use Case

Name

Name

Represents a dynamic use case

Page 11: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Implementing Attributes in a Model

Attribute Type UML Type Java I/F

Inline or relationship

As noted Object

Count Array Array

Unordered/dups Bag Collection

Ordered/dups Sequence List

Unordered/uniq Set Set

Ordered/uniq OrderedSet SortedSet

Page 12: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Templates

Type

ElementType

Page 13: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Packages

Package Name

Name

Page 14: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Activity Diagrams

• Describes a sequential flow of actions. In some ways similar to a state machine, but now a first-class construct.

• Can be used to diagram general process workflows, use cases, and detailed control flows. Very valuable when you model a business.

• Based on Petri Nets (qv).• Resembles old-fashioned flow charts, but often

contain swim-lanes, called activity partitions, that describe what specific classes or subsystems do.

Page 15: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Activity Diagram Changes

• No longer emphasizes transitions (as a super state machine diagram). More concerned with token flow along activity edges.

Page 16: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

Activity Diagram Appearence

Name Name

Initial Node Final Node

Also used for interaction overview diagrams

Page 17: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 State Machine Diagrams

• Used only when a class or subsystem changes its behaviour. A complement to a class or object diagram.

• Two kinds of state machines:– A behavioural state machine describing the life cycle

of a class or subsystem. Typically, the class or subsystem contains a polymorphic reference whose current subclass instance defines the behaviour.

– A protocol state machine documenting the protocol for other subsystems to interact with an interface or port. (This is the traditional role of a state machine.)

Page 18: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Sequence Diagrams

• Describe how multiple classes or subsystems interact dynamically via message passing. Similar in some ways to activity diagrams, but emphasize the messages. Most commonly used interaction diagram.

• Often derived from Use Case Analysis (just like activity diagrams).

• Usually contain vertical swim-lanes, each corresponding to an individual object/actor.

• Messages are shown passing between swim-lanes.

Page 19: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML Sequence Diagram Changes

• Now has ‘fragments’ allowing more complex options to be diagrammed. Also supports reuse of elements.

Page 20: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Communication Diagrams

• Were called Collaboration Diagrams in UML 1.• Show the messages and the objects in their

relationships (the context). Contains the same information as sequence diagrams, but formatted differently. Very useful for analysing class and object diagrams.

• The full set of communication diagrams for a system should map directly onto the object associations of the system. When this is important to know, use communication diagrams rather than sequence diagrams.

Page 21: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Interaction Overview Diagrams

• Introduced in UML 2.

• Top-level description of the main flow of interactions.

• Basically an activity diagram with the main nodes individually documented using separate sequence (or other) diagrams.

• Major step in user-oriented design.

Page 22: UML-2 Changes CSE301 University of Sunderland Harry R Erwin, PhD

UML 2 Timing Diagrams

• Introduced in UML 2.

• Specialized for real-time systems, using a precise time axis.

• MSc-level topic.