Professional Documents
Culture Documents
CS130
Lecture 4
Modeling
Describing a system at a high level of
abstraction
A model of the system
Used for requirements and specification
State machines
Entity-relationship diagrams
Dataflow diagrams
Prof. Majumdar CS 130 Lecture 4
Why?
Natural evolution towards each other
Effort to set an industry standard
UML
UML stands for
Unified Modeling Language
Design by committee
Many interest groups participating
Everyone wants their favorite approach to be in
UML (Cont.)
Resulting design is huge
Many features
Many loosely unrelated styles under one roof
This Lecture
We discuss
Use
case
actor
Use case diagram
shows relationship
between actors and
use cases
Use
case
actor
Prof.
Prof.
Majumdar
Sen CS CS
169130
Lecture
Lecture
5 4
Ride
<<extends>>
passenger
Diagnose
Business
Class Ride
<<extends>>
<<uses>>
Economy
Class Ride
Repair
technician
Prof. Majumdar CS 130 Lecture 4
10
11
12
13
Administrivia
You must bid for the project of your choice by
tonight
Tomorrow we will make the team assignments
On Friday (discussion section), well have the first
team meetings
Come up with a cool name for your project
(Think of project as a startup)
14
Class Diagrams
Train
Describe classes
lastStop
In the OO sense
nextStop
velocity
doorsOpen?
addStop(stop);
startTrain(velocity);
stopTrain();
openDoors();
closeDoors();
15
16
Association
Association between two
classes
if an instance of one class
must know about the
other in order to perform
its work.
Customer
1
*
Order
17
Aggregation
Composition
An association in which
one class belongs to a
collection
Shared: An object can
exist in more than one
collections
Denoted by hollow
diamond on the
contains side
An association in which
one class belongs to a
collection
No Sharing: An object
cannot exist in more than
one collections
Denoted by filled
diamond on the
contains side
18
Car
1
Project
1
4
Wheels
1..*
Consultant
19
Composition
Aggregation
Car
1
Project
1
4
Wheels
1..*
Consultant
20
Generalization
Inheritance between
classes
Button
Denoted by open
triangle
RequestButton
EmergencyButton
21
22
23
24
Object Diagram
Object diagram is an instantiation of a class
diagram
Represents a static structure of a system at a
particular time
25
26
Invalid
Object
Diagram
27
Sequence Diagrams
Sequence diagrams
Refine use cases
Gives view of dynamic behavior of classes
Class diagrams give the static class structure
28
Sequence Diagrams
Class roles: roles that objects play
Lifelines: the existence of an object over time
Activations: time during which an object is
performing an operation
Messages: communications between objects
29
30
31
32
33
Activity Diagrams
Reincarnation of flow charts
Uses flowchart symbols
Emphasis on control-flow
34
35
36
37
38
Activity Diagrams
Swimlanes: responsibility of one or more
objects
Action states: steps in the execution of an
algorithm
Action flows: relationship between the
different action states
Object flow: utilization of objects by action
states
Prof. Majumdar CS 130 Lecture 4
39
What is wrong
with this activity
diagram?
40
StateChart Diagrams
Hierarchical finite automata
Invented by David Harel, 1983
41
Button
off
push
depart
on
42
43
44
This Lecture
We discuss
45
46
47
UML is Happening
UML is being widely adopted
By users
By tool vendors
By programmers
A step forward
Seems useful
First standard for high-levels of software process
Expect further evolution, development of UML
48