2. History
Design notation of variouskindsused since
programming began:
• Flow charts, Pseudo code, StructureDiagrams…
With advent of OO, many conflicting notations
(1980s, 1990s)
Thesenotationswerecombined and unified (late
1990’s)
UML extensively taught in universities
(2000 - now).
3. UML: Unified Modeling Language
An industry-standard graphical languagefor specifying,
visualizing, constructing, and documenting theartifactsof
softwaresystems, aswell asfor businessmodeling.
TheUML usesmostly graphical notationsto expressthe
OO analysisand design of softwareprojects.
Simplifiesthecomplex processof softwaredesign
UML can beused to describe:
theorganization of aprogram
how aprogram executes
how aprogram isused
how aprogram isdeployed over anetwork
…and more
What is UML?
4. Why UMLforModeling?
A diagram/picture= thousandswords
Usesgraphical notation to communicatemoreclearly than
natural language(imprecise) and code(too detailed).
Makesit easier for programmersand softwarearchitectsto
communicate.
Helpsacquirean overall view of asystem.
UML isno t dependent on any onelanguageor technology.
UML movesusfrom fragmentation to standardization.
5. 3 Waysto UseUML
(Both forward & reverseengineering)
1) Sketch e.g. at white board
1) Most common, quick and informal
2) Communication & understanding
2) Blueprint
1) Detailed design, implemented by programmer
2) May havetoolssupporting diagramming
3) Programming Language
1) Toolstranslatediagramsto executablecode
6. During Software Lifecycle:
UMLCan Be Used at Various Stages
Analysis: OOA
• What issystem to do? What servicesisit to provide? Provide
requirementsfor designer.
Design: OOD
• What will betheparts& structureof thesystem? How will
they interact? Provideblueprint for programmer.
Programming: OOP
7. Classification of UMLDiagrams
Structure
1) Class diagram
2) Component diagram (cmptscan beindependently
purchased and replaced)
3) Component structurediagram
4) Deployment diagram (what goeson what machine&
place)
5) Object diagram
6) Packagediagram (pkg = group of classes, e.g.
namespace)
There are 13 + Kinds of UMLDiagrams
8. Classification of UMLDiagrams
(cont.)
Behavior
7) Activity diagram (flow chart)
8) Use Case diagram (scenarios foruse of system)
9) StateMachinediagram
10) Sequence diagram
11) Communication diagram (dataflow diagrams)
12) Interaction diagram (activity + sequencediagrams)
13) Timing diagram
10. Class diagrams
A classdiagram isoften all that isneeded to describea
particular Design Pattern
A classdiagram showsclasses, interfaces, and their
relationships
We’ll cover most of classesand interfaces, and afew of the
most important relationships
Thepurposeof theclassdiagram isto show thetypesbeing
modeled within thesystem.
10
15. An example of Class
Account_Name
- Custom_Name
- Balance
+AddFunds( )
+WithDraw( )
+PayInvoice( )
Name
Attributes
Operations
16. Class Example
class Checking {
private:
char Customer_name[20];
float Balance;
public:
AddFunds(float);
WithDraw(float);
PayInvoice(float);
set_name(string);
get_name();
set_balance(float);
get_balance();
};
17. Relationships between Class
Diagrams
Association-- arelationship between instancesof thetwo classes. There
isan association between two classesif an instanceof oneclassmust know
about theother in order to perform itswork. In adiagram, an association is
alink connecting two classes.
Aggregation-- an association in which oneclassbelongsto acollection.
An aggregation hasadiamond end pointing to thepart containing the
whole.
Generalization-- an inheritancelink indicating oneclassisasuperclass
of theother. A generalization hasatrianglepointing to thesuperclass.
17
18. Notation of Class Diagram: association
Bi-directional association
Associationsareassumed to bebi-directional
e.g. Flight and plane
notation:
Uni-directional association
e.g. Order and item
notation:
Associations represent relationships between instances
of classes .
19. Association: Multiplicity and Roles
University Person
1
1
*
*
Multiplicity
Symbol Meaning
1 One and only one
0..1 Zero or one
M..N From M to N (natural language)
* From zero to any positive integer
0..* From zero to any positive integer
1..* From one to any positive integer
0…8.. From zero to eight
8..14 From eight to fourteen
teacheremployer
RoleRole
“A given university groups many
people; some act as students, others
as teachers. A given student
belongs to a single university; A
given staff belongs to a single
university; a given teacher may or
may not be working for the university
at a particular time.”
student
staff
*
0..1
20. Notation of Class Diagram: Aggregation
AGGREGATION
Aggregation: expresses a relationship among
instances
of related classes.
Containee Classes
Flat
Rooms Storage Room
Example 1
Containee Classes
Car
Motor Wheels
Example2
AGGREGATION
41
23. Elements of Sequence Diagrams
Name: Class
New object
Create
Message
Return
Delete
Self-call
Lifelines
The dotted line that extends down the
vertical axis from the base of each object.
Messages
Labeled as arrows, with the arrowhead
indicating the direction of the call.
Activation bar
The long, thin boxes on the lifelines are
method-invocation boxes indicting that
indicate processing is being performed by
the target object/class to fulfill a message.
Rectangle also denotes when object is
deactivated.
Deletion (X)
Object’s life ends at that point
Activation bar
Sequence Diagrams
24. Example forSequence Diagram
[Fowler]
Wehavean order and aregoing to invokeacommand on it to
calculateitsprice. To do that, theorder needsto look at all theline
itemson theorder and determinetheir prices, which arebased on
thepricing rulesof theorder line’sproducts. Having donethat for
all thelineitems, theorder then needsto computean overall
discount, which isbased on rulestied to thecustomer.
25. Example forSequence Diagram
[Fowler]
Wehavean order and aregoing to invokeacommand on it
to calculateitsprice. To do that, theorder needsto look at
all thelineitemson theorder and determinetheir prices,
which arebased on thepricing rulesof theorder line’s
products. Having donethat for all thelineitems, theorder
then needsto computean overall discount, which isbased
on rulestied to thecustomer.
27. USECASES DIAGRAM
Use cases. A usecasedescribesasequenceof actionsthat provide
something of measurablevalueto an actor and isdrawn asa
horizontal ellipse.
Actors. An actor isaperson, organization, or external system that
playsarolein oneor moreinteractionswith your system. Actorsare
drawn asstick figures
30. Business Use Case Diagram forAirport Check-
In and Security Screening
Business actors :?
Business use cases ?
PLEASE DISCUSS AND EXPLAIN WHY?
31. Business Use Case Diagram forAirport Check-
In and Security Screening
Business actors :Passenger,
Tour Guide,
Minor (Child),
Passenger with Special Needs
(all playing external rolesin relation to airport
business.)
Business use cases are
Individual Check-In,
Group Check-In (for groupsof
tourists),
Security Screening
Baggage Check-in and
Baggage Handling extend Check-In usecases, WHY?
32. Business Use Case Diagram forAirport Check-
In and Security Screening
33. Activity Diagram
Activity diagram isused to show message
flow from oneactivity to another.
Activity Diagrams:
Draw theactivity flow of asystem.
Describethesequencefrom oneactivity
to another.
Describetheparallel, branched and
concurrent flow of thesystem.