SlideShare a Scribd company logo
1 of 82
2 
Example – Car
https://sites.google.com/a/cmrit.ac.in/manoj-c5559/
UNIT – 2: ADVANCED CLASS MODELING, STATE 
MODELING: 
Advanced object and class concepts; Association ends; N-ary 
associations; Aggregation; Abstract classes; Multiple inheritance; 
Metadata; Reification; Constraints; Derived data; Packages; 
Practical tips. 
State Modeling: Events, States, Transitions and Conditions; State 
diagrams; State diagram behaviour; Practical tips.
Advanced object and class concepts 
Enumerations 
Multiplicity 
Scope 
Visibility
Enumeration 
Data type - a set of values together with a set of operations on those 
values 
ī‚—To define a new simple data type, called enumeration type, we need 
2 things: 
ī‚—A name for the data type 
ī‚—A set of values for the data type 
ī‚—enum {FALSE, TRUE}; 
ī‚—enum rank {TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, 
NINE, TEN, JACK, QUEEN, KING, ACE}; 
ī‚—enum colors {BLACK, BLUE, GREEN, CYAN, RED}; 
ī‚—The values are written in all caps because they are constants
Enumerations 
ī‚—When constructing a model, we should carefully note enumerations, 
because they often occur and are important to users. 
ī‚—Enumerations are also significant for an implementation; we may 
display the possible values with a pick list. 
ī‚—Do not use a generalization to capture the values of an Enumerated 
attribute. 
ī‚—An Enumeration is merely a list of values; generalization is a means 
for structuring the description of objects.
Enumerations 
ī‚—In the UML an enumeration is a data type. 
ī‚— The second section lists the enumeration values. 
ī‚—Eg: Boolean type= { TRUE, FALSE}
SSccooppee 
UML specifies two types of scope for members: instance and classifier. 
ī‚—Classifier members are commonly recognized as “static” in many 
programming languages. The scope is the class itself. 
ī‚—Attribute values are equal for all instances 
ī‚—Method invocation does not affect the instance’s state 
ī‚—Instance members are scoped to a specific instance. 
ī‚—Attribute values may vary between instances 
ī‚—Method invocation may affect the instance’s state (i.e., change 
instance’s attributes) 
ī‚—To indicate a classifier scope for a member, its name must be underlined. 
Otherwise, instance scope is assumed by default.
11 
Scope 
ī‚—Individual member data (attributes) may have either class 
scope or instance scope. 
ī‚—Class scope - A single copy of an attribute is shared by all 
instances of a class. 
ī‚— In UML you underline the attribute to indicate class scope: 
productCount : int 
ī‚—Instance scope - Each instance of a class would have its own 
copy of the attribute. All attributes have instance scope by 
default.
12 
Scope examples
Visibility 
ī‚—Visibility refers to the ability of a method to reference a feature from another 
class and has the possible values of public, protected & private. 
ī‚—Public—Visible anywhere that the class in which it appears is visible; 
denoted by +. 
ī‚—Package—Visible anywhere in the package containing the class in which it 
appears; denoted by ~. 
ī‚—Protected—Visible in the class in which it appears and all its sub-classes; 
denoted by #. 
ī‚—Private—Visible only in the class in which it appears; denoted by - 
ī‚—Restricting visibility is the same as restricting accessibility.
Visibility 
ī‚—The UML denotes visibility with a prefix 
ī‚—“+” public 
ī‚—“-” private 
ī‚—“#” protected 
ī‚— “~” package
Visibility Example 
15
N-ary Association 
ī‚—An n-ary association is like a common (binary) association, except 
that more than two association roles involved in it. 
ī‚—The UML symbol for n-ary associations is a diamond with lines 
connecting to related classes. If the association has a name, it is written in 
italics next to the diamond. 
N-ary 
association 
Class1 Class2 
Class3 
Ternary 
association
N-ary Associations 
ī‚—Associations can connect more than one class 
ī‚—Notation: 
Student Advisor 
Major
N-ary Associations 
Train 
date 
trainNo 
Seat 
carriageNo 
seatNo 
Reservation 
1 1..* 
1..* 
Passenger 
name 
title
N-ary Associations 
ī‚—We may occasionally encounter n-ary associations (association 
among 3 or more classes). 
ī‚—But we should try to avoid n-ary associations- most of them 
can be decomposed into binary associations, with possible 
qualifiers and attributes.
20 
N-ary Association
21 
N-ary Association (cont’d) 
decompose
22 
Aggregation 
ī‚—A special form of association that models a whole-part relationship between 
an aggregate (the whole) and its parts. 
ī‚—Models a “is a part-part of” relationship. 
ī‚—The aggregation association represents the part-whole relation between 
classes. 
ī‚—Denoted by a solid diamond and lines 
ī‚—Diamond attaches to the aggregate (whole) while lines attach to the parts 
ī‚—May have all association adornments 
Car Door House 
Whole Part
23 
Aggregation (cont.) 
Car Door House 
Whole Part 
ī‚—Aggregation tests: 
ī‚—Is the phrase “part of” used to describe the relationship? 
ī‚— A door is “part of” a car 
ī‚—Are some operations on the whole automatically applied to its 
parts? 
ī‚— Move the car, move the door. 
ī‚—Are some attribute values propagated from the whole to all or some 
of its parts? 
ī‚— The car is blue, therefore the door is blue. 
ī‚— A door is part of a car. A car is not part of a door.
Aggregation 
Pizza* Order 
Slice 
Crust 
Sauce Serving 
Cheese Serving 
Topping Serving
Composition 
ī‚—Composition is a form of aggregation with strong 
ownership and coincident lifetime of the parts by the 
whole; the part object may belong to only one whole – 
the parts are usually expected to live and die with the 
whole. 
(usually, any deletion of the whole is considered to 
cascade to the parts}{filled diamond} 
25
Aggregation and Composition 
ī‚—Aggregation is a special form of association that specifies a whole-part 
relationship between the aggregate (the whole) and a component (the part); 
aggregation is the part-of relationship. { it is a special form of association 
in which a collection of objects, each having an independent existence, is 
associated with an single object} {unfilled diamond} 
ī‚—Composition is a form of aggregation with strong ownership and 
coincident lifetime of the parts by the whole; the part object may belong to 
only one whole – the parts are usually expected to live and die with the 
whole. 
(usually, any deletion of the whole is considered to cascade to the parts} 
{filled diamond}
Metadata 
ī‚—The term "meta" comes from a Greek word that denotes 
something of a higher or more fundamental nature. 
Metadata, then, is data about other data. 
ī‚—The term refers to any data used to aid the identification, 
description and location of networked electronic resources
Defining Metadata 
ī‚—Librarians equate it with a complete bibliographic record 
ī‚—Information technologists equate it to database schema or 
definitions of the data elements 
ī‚—Archivists include context information, restrictions and 
access terms, index terms, etc.
Metadata 
ī‚—Metadata is data that describes other data. For example, a class 
definition is a metadata. 
ī‚—Models are inherently metadata, since they describe the things 
being modeled (rather than being the things). 
ī‚—Many real-world applications have metadata, such as parts 
catalogs, blueprints, and dictionaries. Computer-languages 
implementations also use metadata heavily.
Derived Data 
ī‚—A derived element is a function of one or more elements, which in 
turn may be derived. 
ī‚— A derived element is redundant, because the other elements 
completely determine it. 
ī‚—Ultimately, the derivation tree terminates with base elements. 
ī‚—Classes, associations, and attributes may be derived. 
ī‚—The notation for a derived element is a slash in front of the element 
name along with constraint that determines the derivation.
Derived Data 
Employee 
Basic Pay 
/gross pay
Packages 
ī‚—A package is a group of elements (classes, association, 
generalization, and lesser packages) with a common theme. 
ī‚—A package partitions a model making it easier to understand and 
manage. Large applications my require several tiers of packages. 
ī‚—Packages form a tree with increasing abstraction toward the root, 
which is the application, the top-level package. 
ī‚—Notation for package is a box with a tab.
Customer Order 
Sales
When to use Package 
ī‚—To create a overview of a large set of model elements 
ī‚—To organize a large model 
ī‚—To group related elements
State Modeling 
ī‚—State model describes the sequences of operations that occur in 
response to external stimuli. 
ī‚—The state model consists of multiple state diagrams, one for each 
class with temporal behavior that is important to an application. 
ī‚—The state diagram is a standard computer science concept that relates 
events and states. 
ī‚—Events represent external stimuli and states represent values objects.
Elements of State Diagrams 
ī‚—The basic elements of state diagrams are 
ī‚—Events – An event is an occurrence at a point in time 
ī‚—states – the state in which the object finds itself at any moment 
ī‚—transitions – take the object from one state to another 
ī‚—actions – take place as a result of a transition
Events 
ī‚—An event is an occurrence at a point in time such as – 
User presses left button 
Indigo flight departs from Mumbai 
ī‚—An event happens instantaneously with regard to time scale of 
an application. 
ī‚—One event may logically precede or follow another, or the two 
events may be unrelated (concurrent; they have no effect on 
each other).
Types of Events 
An event may be one of 3 types 
ī‚—Signal event 
ī‚—Time event 
ī‚—Change event
Signal Event ī‚—A signal is an explicit one-way transmission of information from one 
object to another. 
ī‚—An object sending a signal to another object may expect a reply, but 
the reply is a separate signal under the control of the second object, 
which may or may not choose to send it. 
ī‚— A signal event is the event of sending or receiving a signal (concern 
about receipt of a signal). 
ī‚—The difference between signal and signal event 
ī‚—a signal is a message between objects 
ī‚—a signal event is an occurrence in time.
Time Event 
ī‚—Time event is an event caused by the occurrence of an absolute 
time or the elapse of a time interval. 
ī‚—UML notation for an absolute time is the keyword when 
followed by a parenthesized expression involving time. 
ī‚—The notation for a time interval is the keyword after followed 
by a parenthesized expression that evaluates to a time 
duration. 
when (date = jan 1, 2000 )
Change Event 
A change event occurs whenever a specified condition is met 
ī‚—Event name is specified as keyword when 
ī‚—Parameter list is a Boolean expression 
ī‚—The event occurs when both of the following conditions are met, 
irrespective of the order when they happen 
ī‚— The expression evaluates to true 
ī‚— The object is in the required state 
when (battery power < lower limit ) 
when (tire pressure < minimum pressure )
States 
ī‚—State is a condition or situation during the life of an object within 
which it performs some activity, or waits for some events 
ī‚—The objects in a class have a finite number of possible states. 
ī‚—Each object can be in one state at a time. 
ī‚—A state specifies the response of an object to input events. 
ī‚— At any given point in time, the system is in one state. 
ī‚—It will remain in this state until an event occurs that causes it to 
change state. 
ī‚—Event vs. States 
ī‚—Event represents points in time. 
ī‚—State represents intervals of time.
States 
ī‚—A state is when a system is: 
Doing something – e.g., heating oven, mixing 
ingredients, accelerating engine, 
Waiting for something to happen – Waiting for user to 
enter password, waiting for sensor reading.
Eg: 
power turned on power turned off power turned on 
Time 
Powered 
Not powered 
A state corresponds to the interval between two events received by an 
object. 
The state of an object depends on past events.
Basic UML Syntax 
ī‚—A state is drawn with a 
round box, with three 
compartments for 
ī‚—name 
ī‚—state variables (if any) 
ī‚—actions to be performed 
Name 
state variables 
actions 
sometimes 
left out when 
empty
Transitions 
ī‚—A transition is a relationship between two states indicating that an 
object in the first state will enter the second state. 
ī‚—A transition is an instantaneous change from one state to another. 
ī‚—The transition is said to fire upon the change from the source state to 
target state. 
ī‚—A guard condition must be true in order for a transition to occur. 
ī‚—A guard condition is checked only once, at the time the event occurs, 
and the transition fires if the condition is true.
51 
Transition 
A directed relationship between two states. 
Contains five parts 
ī‚— Source state - current state before transition fires. 
ī‚— Event trigger - external stimulus that has the potential to 
cause a transition to fire. 
ī‚— Guard condition - a condition that must be satisfied before 
a transition can fire. 
ī‚— Target state - new state after transition fires.
Basic UML Syntax 
ī‚—A transition is drawn with 
an arrow, possibly labeled 
with 
ī‚—event causing the 
transaction 
ī‚—guard condition 
ī‚—Action to perform 
AnEvent [guard] / SomeAction
53 
Initial State 
Idle 
Final State 
Running 
Transition 
State 
53
Billing Example 
State Diagrams show the sequences of states an object goes through 
during its life cycle in response to stimuli, together with its responses 
and actions; an abstraction of all possible behaviors. 
Start End 
Unpaid 
Paid 
Invoice created paying Invoice destroying
event action, taken during 
AddParticipant / Set count = 0 
cancel seminar 
transition 
Setup 
do/initialize seminar 
Available 
do/initialize seminar 
[ count = 20 ] 
Full 
do/finalize seminar 
guard 
Canceled 
do/refund payments 
cancel seminar 
multiple 
exits 
cancel 
seminar 
aktivity, carried out 
while in that state
Actions 
ī‚—Action 
ī‚—is an executable atomic computation 
ī‚—includes operation calls, the creation or destruction of 
another object, or the sending of a signal to an object 
ī‚—associated with transitions and during which an action is not 
interruptible -- e.g., entry, exit
Predefined Action Labels 
“entry/” 
ī‚—identifies an action, specified by the corresponding action expression, 
which is performed upon entry to the state (entry action) 
“exit/” 
ī‚—identifies an action, specified by the corresponding action expression, 
that is performed upon exit from the state (exit action) 
“do/” 
ī‚—identifies an ongoing activity (“do activity”) that is performed as long as 
the modeled element is in the state or until the computation specified by 
the action expression is completed (the latter may result in a completion 
event being generated). 
“include/” 
ī‚—is used to identify a submachine invocation. The action expression 
contains the name of the submachine that is to be invoked.
State Diagrams notation 
Initial state final state 
paying 
Unpaid Paid 
Invoice 
created 
Invoice 
destroyed 
name 
state 
transition 
event
Here’s a simple example SD for a 
washing machine. 
State 
Transition 
Condition 
Action
60 
A condition is typically some kind of event, 
e.g.: 
â€ĸSignal 
â€ĸArrival of an object (data/material), 
â€ĸEtcâ€Ļ 
An action is the appropriate output or response 
to the event, e.g.: 
â€ĸSignal or message 
â€ĸTransfer of an object, 
â€ĸCalculation, 
â€ĸEtcâ€Ļ 
Condition 
Action
State Diagrams (Traffic light example) 
Traffic Light 
Red 
Yellow 
Green 
State 
Transition 
Event 
Start
Transitions 
event [guard] | action 
xx yy 
The event that 
triggers the 
transition 
Conditions that 
must be met for 
the transition to 
take place 
The action that 
takes place when 
the transition is 
taken
Initial and Final States 
ī‚—An example: 
At Work go home At Home 
go to work 
die die
64 
State 
Diagrams
65
66
67
68 
Phone Example 
digit dialed (n) 
[incomplete] 
connected 
Dialing Connecting 
busy 
digit dialed (n) 
digit dialed (n) [valid] / connect 
[invalid] 
Invalid 
Ringing 
Busy 
68
69
States of Garment (Garments system) 
Garment 
ordered 
Material 
ordered 
Material 
delivered 
Marked out for 
cutting 
Sewn 
Marked out for 
sewing 
Cut 
Marked out for 
finishing 
Finished 
Deleted
71 
State Diagrams 
ī‚—A state diagram describes the behaviour of a system, 
some part of a system, or an individual object. 
ī‚—At any given point in time, the system or object is in a 
certain state. 
ī‚— Being in a state means that it is will behave in a specific way in 
response to any events that occur. 
ī‚—Some events will cause the system to change state. 
ī‚— In the new state, the system will behave in a different way to 
events. 
ī‚—A state diagram is a directed graph where the nodes are 
states and the arcs are transitions.
Using Microsoft Visio 
72 
ī‚—Visio can be used to draw UML diagrams 
ī‚—It is component of Microsoft Office
Using Microsoft Visio (continued) 
Available Sets of Shapes in the UML Collection 
īƒ˜Activity Diagrams 
īƒ˜Collaboration Diagrams 
īƒ˜Components 
īƒ˜Deployment Diagrams 
īƒ˜Sequence Diagrams 
īƒ˜State Diagrams (Statecharts) 
īƒ˜Static Structures (shown) – include Packages and Classes 
īƒ˜Use Case Diagrams 
73
Using Microsoft Visio (concluded) 
74 
UML symbols can be 
displayed as icons with names 
or icons with descriptions 
Both forms of display for the 
Use Case shape set are shown 
Now, on to the demo!
75 
state 
start state 
stop state 
transition from one state to 
another 
self-transition (no 
change of state) 
event [guard] / action transition label (each of the three 
parts is optional)
The Inheritance Mechanism 
ī‚—Means of deriving new class from existing classes, called 
base classes 
ī‚—Reuses existing code eliminating tedious, error prone task 
of developing new code 
ī‚—Derived class developed from base by adding or altering 
code
Multiple Inheritance 
ī‚—A derived class with several base classes is known as multiple inheritance 
ī‚—Multiple inheritance permits a class to have more than one super class and 
to inherit features from all parents. 
ī‚— We can mix information from 2 or more sources. 
ī‚—This is a more complicated from of generalization than single inheritance. 
ī‚—The advantage of multiple inheritance is greater power in specifying classes 
and an increased opportunity for reuse. 
ī‚—The disadvantage is a loss of conceptual and implementation simplicity.
Credit Cards - Single Inheritance 
Same basic features 
Each is a little different
Voice Mail - Multiple Inheritance 
Voice mail has features 
of both mail and phone
What Is A Constraint 
ī‚—A condition or restriction (a Boolean expression) expressed in natural 
language text or in a machine readable language for the purpose of declaring 
some of the semantics of an element 
ī‚—Some are predefined in UML (“xor”), others may be user-defined 
ī‚—OCL (Object Constraint Language) is a predefined language for writing 
constraints
81 
Constraints 
ī‚—These are functional relation between entities of an object 
model. 
ī‚—Entity includes objects, classes, attributes, links and 
associations. 
ī‚—A constraint restricts the values that entities can assume. 
ī‚—Simple constraints may be placed in object models and 
complex may be in functional model.
82 
Employee 
salary 
boss 
{ salary < = boss.salary } 
Window 
Length 
width 
{ 0.8 <= length / width < = 1.5 } 
Constraints on objects

More Related Content

What's hot

INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSAshita Agrawal
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML DiagramsManish Kumar
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentationmewaseem
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An OverviewRaj Thilak S
 
Lecture 12 requirements modeling - (system analysis)
Lecture 12   requirements modeling - (system analysis)Lecture 12   requirements modeling - (system analysis)
Lecture 12 requirements modeling - (system analysis)IIUI
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static ModelingSaurabh Kumar
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbolsKumar
 
Case study-the next gen pos
Case study-the next gen posCase study-the next gen pos
Case study-the next gen posVignesh Saravanan
 
CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3Gobinath Subramaniam
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringMeghaj Mallick
 
Chapter-4 Enhanced ER Model
Chapter-4 Enhanced ER ModelChapter-4 Enhanced ER Model
Chapter-4 Enhanced ER ModelKunal Anand
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram Rahul Pola
 
Domain class model
Domain class modelDomain class model
Domain class modelshekharsj
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)paramisoft
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering conceptsKomal Singh
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagramsSwathy T
 

What's hot (20)

UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMS
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
Lecture 12 requirements modeling - (system analysis)
Lecture 12   requirements modeling - (system analysis)Lecture 12   requirements modeling - (system analysis)
Lecture 12 requirements modeling - (system analysis)
 
Dynamic and Static Modeling
Dynamic and Static ModelingDynamic and Static Modeling
Dynamic and Static Modeling
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
Case study-the next gen pos
Case study-the next gen posCase study-the next gen pos
Case study-the next gen pos
 
CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3CS8592-OOAD Lecture Notes Unit-3
CS8592-OOAD Lecture Notes Unit-3
 
Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Design Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software EngineeringDesign Model & User Interface Design in Software Engineering
Design Model & User Interface Design in Software Engineering
 
Chapter-4 Enhanced ER Model
Chapter-4 Enhanced ER ModelChapter-4 Enhanced ER Model
Chapter-4 Enhanced ER Model
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 
Domain class model
Domain class modelDomain class model
Domain class model
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Object oriented software engineering concepts
Object oriented software engineering conceptsObject oriented software engineering concepts
Object oriented software engineering concepts
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagrams
 

Similar to Unit 2(advanced class modeling & state diagram)

OOMD UNIT2.pdf
OOMD UNIT2.pdfOOMD UNIT2.pdf
OOMD UNIT2.pdfSadikAmin3
 
Umldiagram
UmldiagramUmldiagram
Umldiagrampavandeep11
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagramskebsterz
 
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2rchakra
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented DesignAravinth NSP
 
2 class use case
2 class use case2 class use case
2 class use caseMinal Maniar
 
Unit two concept of classes and objects
Unit two concept of classes and objects Unit two concept of classes and objects
Unit two concept of classes and objects Dr Chetan Shelke
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UMLyndaravind
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.pptChishaleFriday
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptxRokaKaram
 
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptNgoHuuNhan1
 
UML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingUML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingStefano Dalla Palma
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manualendokayle
 
class diagram
class diagramclass diagram
class diagramShohan Ean
 

Similar to Unit 2(advanced class modeling & state diagram) (20)

OOMD UNIT2.pdf
OOMD UNIT2.pdfOOMD UNIT2.pdf
OOMD UNIT2.pdf
 
Uml report
Uml reportUml report
Uml report
 
Umldiagram
UmldiagramUmldiagram
Umldiagram
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
 
Intro to UML 2
Intro to UML 2Intro to UML 2
Intro to UML 2
 
Jar chapter 2
Jar chapter 2Jar chapter 2
Jar chapter 2
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
2 class use case
2 class use case2 class use case
2 class use case
 
Unit two concept of classes and objects
Unit two concept of classes and objects Unit two concept of classes and objects
Unit two concept of classes and objects
 
Intro Uml
Intro UmlIntro Uml
Intro Uml
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
ObjectOrientedSystems.ppt
ObjectOrientedSystems.pptObjectOrientedSystems.ppt
ObjectOrientedSystems.ppt
 
3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx3_ObjectOrientedSystems.pptx
3_ObjectOrientedSystems.pptx
 
Css uml
Css umlCss uml
Css uml
 
CHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.pptCHAPTER 1 - OVERVIEW OOP.ppt
CHAPTER 1 - OVERVIEW OOP.ppt
 
uml2-1214558329929112-8.ppt
uml2-1214558329929112-8.pptuml2-1214558329929112-8.ppt
uml2-1214558329929112-8.ppt
 
Interfaces & Packages V2
Interfaces & Packages V2Interfaces & Packages V2
Interfaces & Packages V2
 
UML, ER and Dimensional Modelling
UML, ER and Dimensional ModellingUML, ER and Dimensional Modelling
UML, ER and Dimensional Modelling
 
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution ManualData Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
Data Modeling and Database Design 2nd Edition by Umanath Scamell Solution Manual
 
class diagram
class diagramclass diagram
class diagram
 

More from Manoj Reddy

Project report
Project reportProject report
Project reportManoj Reddy
 
Institutional support
Institutional supportInstitutional support
Institutional supportManoj Reddy
 
Directing & controling
Directing & controlingDirecting & controling
Directing & controlingManoj Reddy
 
Enterperneur
EnterperneurEnterperneur
EnterperneurManoj Reddy
 
Management principals
Management principalsManagement principals
Management principalsManoj Reddy
 

More from Manoj Reddy (7)

Ssi
SsiSsi
Ssi
 
Project report
Project reportProject report
Project report
 
Planning
PlanningPlanning
Planning
 
Institutional support
Institutional supportInstitutional support
Institutional support
 
Directing & controling
Directing & controlingDirecting & controling
Directing & controling
 
Enterperneur
EnterperneurEnterperneur
Enterperneur
 
Management principals
Management principalsManagement principals
Management principals
 

Recently uploaded

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncssuser2ae721
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEroselinkalist12
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvLewisJB
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxPurva Nikam
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoÃŖo Esperancinha
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniquesugginaramesh
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 

Recently uploaded (20)

CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsyncWhy does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
Why does (not) Kafka need fsync: Eliminating tail latency spikes caused by fsync
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETEINFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
INFLUENCE OF NANOSILICA ON THE PROPERTIES OF CONCRETE
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Work Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvvWork Experience-Dalton Park.pptxfvvvvvvv
Work Experience-Dalton Park.pptxfvvvvvvv
 
An introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptxAn introduction to Semiconductor and its types.pptx
An introduction to Semiconductor and its types.pptx
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
Comparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization TechniquesComparative Analysis of Text Summarization Techniques
Comparative Analysis of Text Summarization Techniques
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)
Call Us â‰Ŋ 8377877756 â‰ŧ Call Girls In Shastri Nagar (Delhi)
 

Unit 2(advanced class modeling & state diagram)

  • 1.
  • 4. UNIT – 2: ADVANCED CLASS MODELING, STATE MODELING: Advanced object and class concepts; Association ends; N-ary associations; Aggregation; Abstract classes; Multiple inheritance; Metadata; Reification; Constraints; Derived data; Packages; Practical tips. State Modeling: Events, States, Transitions and Conditions; State diagrams; State diagram behaviour; Practical tips.
  • 5. Advanced object and class concepts Enumerations Multiplicity Scope Visibility
  • 6. Enumeration Data type - a set of values together with a set of operations on those values ī‚—To define a new simple data type, called enumeration type, we need 2 things: ī‚—A name for the data type ī‚—A set of values for the data type ī‚—enum {FALSE, TRUE}; ī‚—enum rank {TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE}; ī‚—enum colors {BLACK, BLUE, GREEN, CYAN, RED}; ī‚—The values are written in all caps because they are constants
  • 7. Enumerations ī‚—When constructing a model, we should carefully note enumerations, because they often occur and are important to users. ī‚—Enumerations are also significant for an implementation; we may display the possible values with a pick list. ī‚—Do not use a generalization to capture the values of an Enumerated attribute. ī‚—An Enumeration is merely a list of values; generalization is a means for structuring the description of objects.
  • 8. Enumerations ī‚—In the UML an enumeration is a data type. ī‚— The second section lists the enumeration values. ī‚—Eg: Boolean type= { TRUE, FALSE}
  • 9.
  • 10. SSccooppee UML specifies two types of scope for members: instance and classifier. ī‚—Classifier members are commonly recognized as “static” in many programming languages. The scope is the class itself. ī‚—Attribute values are equal for all instances ī‚—Method invocation does not affect the instance’s state ī‚—Instance members are scoped to a specific instance. ī‚—Attribute values may vary between instances ī‚—Method invocation may affect the instance’s state (i.e., change instance’s attributes) ī‚—To indicate a classifier scope for a member, its name must be underlined. Otherwise, instance scope is assumed by default.
  • 11. 11 Scope ī‚—Individual member data (attributes) may have either class scope or instance scope. ī‚—Class scope - A single copy of an attribute is shared by all instances of a class. ī‚— In UML you underline the attribute to indicate class scope: productCount : int ī‚—Instance scope - Each instance of a class would have its own copy of the attribute. All attributes have instance scope by default.
  • 13. Visibility ī‚—Visibility refers to the ability of a method to reference a feature from another class and has the possible values of public, protected & private. ī‚—Public—Visible anywhere that the class in which it appears is visible; denoted by +. ī‚—Package—Visible anywhere in the package containing the class in which it appears; denoted by ~. ī‚—Protected—Visible in the class in which it appears and all its sub-classes; denoted by #. ī‚—Private—Visible only in the class in which it appears; denoted by - ī‚—Restricting visibility is the same as restricting accessibility.
  • 14. Visibility ī‚—The UML denotes visibility with a prefix ī‚—“+” public ī‚—“-” private ī‚—“#” protected ī‚— “~” package
  • 16. N-ary Association ī‚—An n-ary association is like a common (binary) association, except that more than two association roles involved in it. ī‚—The UML symbol for n-ary associations is a diamond with lines connecting to related classes. If the association has a name, it is written in italics next to the diamond. N-ary association Class1 Class2 Class3 Ternary association
  • 17. N-ary Associations ī‚—Associations can connect more than one class ī‚—Notation: Student Advisor Major
  • 18. N-ary Associations Train date trainNo Seat carriageNo seatNo Reservation 1 1..* 1..* Passenger name title
  • 19. N-ary Associations ī‚—We may occasionally encounter n-ary associations (association among 3 or more classes). ī‚—But we should try to avoid n-ary associations- most of them can be decomposed into binary associations, with possible qualifiers and attributes.
  • 21. 21 N-ary Association (cont’d) decompose
  • 22. 22 Aggregation ī‚—A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts. ī‚—Models a “is a part-part of” relationship. ī‚—The aggregation association represents the part-whole relation between classes. ī‚—Denoted by a solid diamond and lines ī‚—Diamond attaches to the aggregate (whole) while lines attach to the parts ī‚—May have all association adornments Car Door House Whole Part
  • 23. 23 Aggregation (cont.) Car Door House Whole Part ī‚—Aggregation tests: ī‚—Is the phrase “part of” used to describe the relationship? ī‚— A door is “part of” a car ī‚—Are some operations on the whole automatically applied to its parts? ī‚— Move the car, move the door. ī‚—Are some attribute values propagated from the whole to all or some of its parts? ī‚— The car is blue, therefore the door is blue. ī‚— A door is part of a car. A car is not part of a door.
  • 24. Aggregation Pizza* Order Slice Crust Sauce Serving Cheese Serving Topping Serving
  • 25. Composition ī‚—Composition is a form of aggregation with strong ownership and coincident lifetime of the parts by the whole; the part object may belong to only one whole – the parts are usually expected to live and die with the whole. (usually, any deletion of the whole is considered to cascade to the parts}{filled diamond} 25
  • 26. Aggregation and Composition ī‚—Aggregation is a special form of association that specifies a whole-part relationship between the aggregate (the whole) and a component (the part); aggregation is the part-of relationship. { it is a special form of association in which a collection of objects, each having an independent existence, is associated with an single object} {unfilled diamond} ī‚—Composition is a form of aggregation with strong ownership and coincident lifetime of the parts by the whole; the part object may belong to only one whole – the parts are usually expected to live and die with the whole. (usually, any deletion of the whole is considered to cascade to the parts} {filled diamond}
  • 27.
  • 28.
  • 29. Metadata ī‚—The term "meta" comes from a Greek word that denotes something of a higher or more fundamental nature. Metadata, then, is data about other data. ī‚—The term refers to any data used to aid the identification, description and location of networked electronic resources
  • 30. Defining Metadata ī‚—Librarians equate it with a complete bibliographic record ī‚—Information technologists equate it to database schema or definitions of the data elements ī‚—Archivists include context information, restrictions and access terms, index terms, etc.
  • 31. Metadata ī‚—Metadata is data that describes other data. For example, a class definition is a metadata. ī‚—Models are inherently metadata, since they describe the things being modeled (rather than being the things). ī‚—Many real-world applications have metadata, such as parts catalogs, blueprints, and dictionaries. Computer-languages implementations also use metadata heavily.
  • 32. Derived Data ī‚—A derived element is a function of one or more elements, which in turn may be derived. ī‚— A derived element is redundant, because the other elements completely determine it. ī‚—Ultimately, the derivation tree terminates with base elements. ī‚—Classes, associations, and attributes may be derived. ī‚—The notation for a derived element is a slash in front of the element name along with constraint that determines the derivation.
  • 33. Derived Data Employee Basic Pay /gross pay
  • 34. Packages ī‚—A package is a group of elements (classes, association, generalization, and lesser packages) with a common theme. ī‚—A package partitions a model making it easier to understand and manage. Large applications my require several tiers of packages. ī‚—Packages form a tree with increasing abstraction toward the root, which is the application, the top-level package. ī‚—Notation for package is a box with a tab.
  • 36. When to use Package ī‚—To create a overview of a large set of model elements ī‚—To organize a large model ī‚—To group related elements
  • 37.
  • 38. State Modeling ī‚—State model describes the sequences of operations that occur in response to external stimuli. ī‚—The state model consists of multiple state diagrams, one for each class with temporal behavior that is important to an application. ī‚—The state diagram is a standard computer science concept that relates events and states. ī‚—Events represent external stimuli and states represent values objects.
  • 39. Elements of State Diagrams ī‚—The basic elements of state diagrams are ī‚—Events – An event is an occurrence at a point in time ī‚—states – the state in which the object finds itself at any moment ī‚—transitions – take the object from one state to another ī‚—actions – take place as a result of a transition
  • 40. Events ī‚—An event is an occurrence at a point in time such as – User presses left button Indigo flight departs from Mumbai ī‚—An event happens instantaneously with regard to time scale of an application. ī‚—One event may logically precede or follow another, or the two events may be unrelated (concurrent; they have no effect on each other).
  • 41. Types of Events An event may be one of 3 types ī‚—Signal event ī‚—Time event ī‚—Change event
  • 42. Signal Event ī‚—A signal is an explicit one-way transmission of information from one object to another. ī‚—An object sending a signal to another object may expect a reply, but the reply is a separate signal under the control of the second object, which may or may not choose to send it. ī‚— A signal event is the event of sending or receiving a signal (concern about receipt of a signal). ī‚—The difference between signal and signal event ī‚—a signal is a message between objects ī‚—a signal event is an occurrence in time.
  • 43. Time Event ī‚—Time event is an event caused by the occurrence of an absolute time or the elapse of a time interval. ī‚—UML notation for an absolute time is the keyword when followed by a parenthesized expression involving time. ī‚—The notation for a time interval is the keyword after followed by a parenthesized expression that evaluates to a time duration. when (date = jan 1, 2000 )
  • 44. Change Event A change event occurs whenever a specified condition is met ī‚—Event name is specified as keyword when ī‚—Parameter list is a Boolean expression ī‚—The event occurs when both of the following conditions are met, irrespective of the order when they happen ī‚— The expression evaluates to true ī‚— The object is in the required state when (battery power < lower limit ) when (tire pressure < minimum pressure )
  • 45. States ī‚—State is a condition or situation during the life of an object within which it performs some activity, or waits for some events ī‚—The objects in a class have a finite number of possible states. ī‚—Each object can be in one state at a time. ī‚—A state specifies the response of an object to input events. ī‚— At any given point in time, the system is in one state. ī‚—It will remain in this state until an event occurs that causes it to change state. ī‚—Event vs. States ī‚—Event represents points in time. ī‚—State represents intervals of time.
  • 46. States ī‚—A state is when a system is: Doing something – e.g., heating oven, mixing ingredients, accelerating engine, Waiting for something to happen – Waiting for user to enter password, waiting for sensor reading.
  • 47. Eg: power turned on power turned off power turned on Time Powered Not powered A state corresponds to the interval between two events received by an object. The state of an object depends on past events.
  • 48. Basic UML Syntax ī‚—A state is drawn with a round box, with three compartments for ī‚—name ī‚—state variables (if any) ī‚—actions to be performed Name state variables actions sometimes left out when empty
  • 49.
  • 50. Transitions ī‚—A transition is a relationship between two states indicating that an object in the first state will enter the second state. ī‚—A transition is an instantaneous change from one state to another. ī‚—The transition is said to fire upon the change from the source state to target state. ī‚—A guard condition must be true in order for a transition to occur. ī‚—A guard condition is checked only once, at the time the event occurs, and the transition fires if the condition is true.
  • 51. 51 Transition A directed relationship between two states. Contains five parts ī‚— Source state - current state before transition fires. ī‚— Event trigger - external stimulus that has the potential to cause a transition to fire. ī‚— Guard condition - a condition that must be satisfied before a transition can fire. ī‚— Target state - new state after transition fires.
  • 52. Basic UML Syntax ī‚—A transition is drawn with an arrow, possibly labeled with ī‚—event causing the transaction ī‚—guard condition ī‚—Action to perform AnEvent [guard] / SomeAction
  • 53. 53 Initial State Idle Final State Running Transition State 53
  • 54. Billing Example State Diagrams show the sequences of states an object goes through during its life cycle in response to stimuli, together with its responses and actions; an abstraction of all possible behaviors. Start End Unpaid Paid Invoice created paying Invoice destroying
  • 55. event action, taken during AddParticipant / Set count = 0 cancel seminar transition Setup do/initialize seminar Available do/initialize seminar [ count = 20 ] Full do/finalize seminar guard Canceled do/refund payments cancel seminar multiple exits cancel seminar aktivity, carried out while in that state
  • 56. Actions ī‚—Action ī‚—is an executable atomic computation ī‚—includes operation calls, the creation or destruction of another object, or the sending of a signal to an object ī‚—associated with transitions and during which an action is not interruptible -- e.g., entry, exit
  • 57. Predefined Action Labels “entry/” ī‚—identifies an action, specified by the corresponding action expression, which is performed upon entry to the state (entry action) “exit/” ī‚—identifies an action, specified by the corresponding action expression, that is performed upon exit from the state (exit action) “do/” ī‚—identifies an ongoing activity (“do activity”) that is performed as long as the modeled element is in the state or until the computation specified by the action expression is completed (the latter may result in a completion event being generated). “include/” ī‚—is used to identify a submachine invocation. The action expression contains the name of the submachine that is to be invoked.
  • 58. State Diagrams notation Initial state final state paying Unpaid Paid Invoice created Invoice destroyed name state transition event
  • 59. Here’s a simple example SD for a washing machine. State Transition Condition Action
  • 60. 60 A condition is typically some kind of event, e.g.: â€ĸSignal â€ĸArrival of an object (data/material), â€ĸEtcâ€Ļ An action is the appropriate output or response to the event, e.g.: â€ĸSignal or message â€ĸTransfer of an object, â€ĸCalculation, â€ĸEtcâ€Ļ Condition Action
  • 61. State Diagrams (Traffic light example) Traffic Light Red Yellow Green State Transition Event Start
  • 62. Transitions event [guard] | action xx yy The event that triggers the transition Conditions that must be met for the transition to take place The action that takes place when the transition is taken
  • 63. Initial and Final States ī‚—An example: At Work go home At Home go to work die die
  • 65. 65
  • 66. 66
  • 67. 67
  • 68. 68 Phone Example digit dialed (n) [incomplete] connected Dialing Connecting busy digit dialed (n) digit dialed (n) [valid] / connect [invalid] Invalid Ringing Busy 68
  • 69. 69
  • 70. States of Garment (Garments system) Garment ordered Material ordered Material delivered Marked out for cutting Sewn Marked out for sewing Cut Marked out for finishing Finished Deleted
  • 71. 71 State Diagrams ī‚—A state diagram describes the behaviour of a system, some part of a system, or an individual object. ī‚—At any given point in time, the system or object is in a certain state. ī‚— Being in a state means that it is will behave in a specific way in response to any events that occur. ī‚—Some events will cause the system to change state. ī‚— In the new state, the system will behave in a different way to events. ī‚—A state diagram is a directed graph where the nodes are states and the arcs are transitions.
  • 72. Using Microsoft Visio 72 ī‚—Visio can be used to draw UML diagrams ī‚—It is component of Microsoft Office
  • 73. Using Microsoft Visio (continued) Available Sets of Shapes in the UML Collection īƒ˜Activity Diagrams īƒ˜Collaboration Diagrams īƒ˜Components īƒ˜Deployment Diagrams īƒ˜Sequence Diagrams īƒ˜State Diagrams (Statecharts) īƒ˜Static Structures (shown) – include Packages and Classes īƒ˜Use Case Diagrams 73
  • 74. Using Microsoft Visio (concluded) 74 UML symbols can be displayed as icons with names or icons with descriptions Both forms of display for the Use Case shape set are shown Now, on to the demo!
  • 75. 75 state start state stop state transition from one state to another self-transition (no change of state) event [guard] / action transition label (each of the three parts is optional)
  • 76. The Inheritance Mechanism ī‚—Means of deriving new class from existing classes, called base classes ī‚—Reuses existing code eliminating tedious, error prone task of developing new code ī‚—Derived class developed from base by adding or altering code
  • 77. Multiple Inheritance ī‚—A derived class with several base classes is known as multiple inheritance ī‚—Multiple inheritance permits a class to have more than one super class and to inherit features from all parents. ī‚— We can mix information from 2 or more sources. ī‚—This is a more complicated from of generalization than single inheritance. ī‚—The advantage of multiple inheritance is greater power in specifying classes and an increased opportunity for reuse. ī‚—The disadvantage is a loss of conceptual and implementation simplicity.
  • 78. Credit Cards - Single Inheritance Same basic features Each is a little different
  • 79. Voice Mail - Multiple Inheritance Voice mail has features of both mail and phone
  • 80. What Is A Constraint ī‚—A condition or restriction (a Boolean expression) expressed in natural language text or in a machine readable language for the purpose of declaring some of the semantics of an element ī‚—Some are predefined in UML (“xor”), others may be user-defined ī‚—OCL (Object Constraint Language) is a predefined language for writing constraints
  • 81. 81 Constraints ī‚—These are functional relation between entities of an object model. ī‚—Entity includes objects, classes, attributes, links and associations. ī‚—A constraint restricts the values that entities can assume. ī‚—Simple constraints may be placed in object models and complex may be in functional model.
  • 82. 82 Employee salary boss { salary < = boss.salary } Window Length width { 0.8 <= length / width < = 1.5 } Constraints on objects

Editor's Notes

  1. The names of n-ary associations should contain the names of all the classes, e.g. “Advisor advises Student in Major”.
  2. RSM Implementation Note: the use of a note to express the constraint is optional in UML. For instance, it should be possible to draw a dashed line with the label xor between the Account-Person and Account-Corporation associations. In RSM, the use of the note symbol is imposed. RSM has a built-in OCL editor with completion lists. The 2 examples on the right were written using this editor.