Introduction to the Unified Modeling Language Object Oriented Analysis and Design Aron Trauring T++ Technical Skills Training Program CUNY Institute for Software Design & Development (CISDD) New York Software Industry Association (NYSIA) December 3rd, 2004
Aron Trauring — Zoteca
T++ — CISDD — NYSIA
UML Intro - OOAD
What is the UML The UML is a family of graphical notations, backed by single meta-model, that help in describing and designing software systems, particularly software systems built using the object-oriented (OO) style. — Martin Fowler • Object Management Group standard — Version 2.0 • Set of diagrams which are formally defined (meta-model) • Targeted at OO A/D
Aron Trauring — Zoteca
1
T++ — CISDD — NYSIA
UML Intro - OOAD
Ways of Using UML • Sketch • Blueprint • Programming Language
Aron Trauring — Zoteca
2
T++ — CISDD — NYSIA
UML Intro - OOAD
UML as Sketch • Help informally communicate some aspects of a system — explorative • Selectivity — only select important issues • Short sessions: minutes, hours depending on scope • Collaborative — focus on communication not completeness or correctness • Forward engineering — sketch UML diagrams before you write code • Reverse engineering — builds a UML diagram from existing code
Aron Trauring — Zoteca
3
T++ — CISDD — NYSIA
UML Intro - OOAD
UML as Blueprint • Completeness — definitive • Forward engineering — Waterfall approach incompatible with agile, iterative methods • Reverse engineering — useful as documentation, or graphic window into the code • Round-trip CASE tools • Some code generation
Aron Trauring — Zoteca
4
T++ — CISDD — NYSIA
UML Intro - OOAD
UML as Programming Language • UML compiled into executable code • Early versions of C++ gave C code • iLogix STATEMATE • Model Driven Architecture (MDA) — standard approach to UMLPL • An alternative abstraction
Aron Trauring — Zoteca
5
T++ — CISDD — NYSIA
UML Intro - OOAD
Modeling Three System Perspectives 1. Conceptual — Domain of Study — Domain Model — Analysis (UML) 2. Protocol(Interface) — Domain Layer — Design (UML/Python) 3. Implementation — Software Layer — Programming (Python)
Aron Trauring — Zoteca
6
T++ — CISDD — NYSIA
UML Intro - OOAD
Keep in Mind • As sketchers, meta-model and exact syntax is not crucial • Informal usage might not comply with standards (v1.3 vs v2.0) • Be agile — do the least amount of modeling work necessary • True measure of success: Working Code that Meets Customer Needs • Use other modeling tools — CRC, Python, other diagram types
Aron Trauring — Zoteca
7
T++ — CISDD — NYSIA
UML Intro - OOAD
UML History • 70s Structured Programming Gurus • 80s OO Gurus • 1980-1995 Graphic Modeling Wars • Three Amigos — Booch, Jacobson and Rumbaugh • Rational Systems (now owned by IBM) • Competitors dragged in OMG • Version 1.0 — January 1997 Aron Trauring — Zoteca
8
T++ — CISDD — NYSIA
UML Intro - OOAD
• Rational is trying to sell you something
Aron Trauring — Zoteca
9
T++ — CISDD — NYSIA
UML Intro - OOAD
UML Diagram Types • Static — Structure Diagrams • Dynamic — Behavior Diagrams • Model both simultaneously • Different meaning at different levels
Aron Trauring — Zoteca
10
T++ — CISDD — NYSIA
UML Intro - OOAD
Use Cases • A technique for capturing the functional requirements of a system • Describing the typical interactions between the users of a system and the system itself • Provide a “story” or narrative of how a system is used • Near unanimous consent that they should be text based • UML provides diagram but does not mandate
Aron Trauring — Zoteca
11
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Use Case Text
Aron Trauring — Zoteca
12
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Use Case Diagram
Aron Trauring — Zoteca
13
T++ — CISDD — NYSIA
Aron Trauring — Zoteca
UML Intro - OOAD
14
T++ — CISDD — NYSIA
UML Intro - OOAD
Class Diagrams • Most widely UML diagrams • Subject to the greatest range of modeling concepts. • Describes the types of objects in the system and the various kinds of static relationships that exist among them • Show the properties and operations of a class and the constraints that apply to the way objects are connected
Aron Trauring — Zoteca
15
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Class Diagram
Aron Trauring — Zoteca
16
T++ — CISDD — NYSIA
Aron Trauring — Zoteca
UML Intro - OOAD
17
T++ — CISDD — NYSIA
UML Intro - OOAD
Sequence Diagrams • Interaction diagrams describe how groups of objects collaborate in some behavior • Sequence diagram is most typical form • Goes hand in hand with Class diagrams • Captures the behavior of a single scenario • Shows a number of example objects and the messages that are passed between these objects within the use case
Aron Trauring — Zoteca
18
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Sequence Diagram
Aron Trauring — Zoteca
19
T++ — CISDD — NYSIA
Aron Trauring — Zoteca
UML Intro - OOAD
20
T++ — CISDD — NYSIA
UML Intro - OOAD
Communication Diagrams • A kind of interaction diagram (alternative to Sequence diagrams) • Emphasize the data links between the various participants in the interaction • Allows free placement of participants, allows you to draw links to show how the participants connect, and use numbering to show the sequence of message • Collaboration diagrams in UML 1.x
Aron Trauring — Zoteca
21
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Communication Diagram
Aron Trauring — Zoteca
22
T++ — CISDD — NYSIA
UML Intro - OOAD
Package Diagrams • A package is a grouping construct that allows you to take any construct in the UML and group its elements together into higher-level units • Most common use to group classes • In a UML model, each class is a member of a single package. • Packages can also be members of other packages • Correspond to programming language constructs — such as Packages in Python • Each package represents a namespace • Every class must have a unique name within its owning package Aron Trauring — Zoteca
23
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Package Diagram
Aron Trauring — Zoteca
24
T++ — CISDD — NYSIA
Aron Trauring — Zoteca
UML Intro - OOAD
25
T++ — CISDD — NYSIA
UML Intro - OOAD
Activity Diagrams • A technique to describe procedural logic, business process, and work flow • Similar to flowcharts, • Support parallel behavior
Aron Trauring — Zoteca
26
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample Activity Diagram
Aron Trauring — Zoteca
27
T++ — CISDD — NYSIA
Aron Trauring — Zoteca
UML Intro - OOAD
28
T++ — CISDD — NYSIA
UML Intro - OOAD
State Diagrams • Describe the behavior of reactive systems • System enters and exits states based on events and actions • In pure software systems mostly for GUI or asynchronous networking • Useful for embedded systems
Aron Trauring — Zoteca
29
T++ — CISDD — NYSIA
UML Intro - OOAD
Sample State Diagram
Aron Trauring — Zoteca
30