SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler offline
Software Engineering Principles
Ajit K Nayak, Ph.D.
ajitnayak@soauniversity.ac.in
Behavioural Modelling - II
Acknowledgements
‱ Slides of Prof. Rajib Mall, IIT, KGP
State Diagram
‱ 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.
Event, Condition
‱ Event: something that happens at a point in time
– Operator presses self-test button
– The alarm goes off
‱ Condition: something that has a duration
– The fuel level is high
– The alarm is on
‱ State : an abstraction of the attributes and links of an
object (or entire system)
– The controller is in the state self-test after the self-test
button has been pressed and the rest button is not yet
pressed.
– The tank is in the state too low when the fuel level has
been below Ievel-low for alarm-threshold seconds
State diagrams – an example
‱ tic-tac-toe game
(also called noughts and crosses)
State & Transition
‱ 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.
‱ A state is represented by a rounded rectangle containing
the name of the state.
‱ Special states:
– A black circle represents the start state
– A circle with a ring around it represents an end state
‱ A transition represents a change of state in response to an
event.
– It is considered to occur instantaneously.
‱ The label on each transition is the event that causes the
change of state.
State diagram of a phone
State transition with condition
Activities in state diagrams
‱ An activity is something that takes place while the
system is in a state.
– It takes a period of time.
– The system may take a transition out of the state in
response to completion of the activity,
– Some other outgoing transition may result in:
‱ The interruption of the activity, and
‱ An early exit from the state.
Actions in state diagrams
‱ An action is something that takes place effectively
instantaneously
– When a particular transition is taken,
– Upon entry into a particular state, or
– Upon exit from a particular state
‱ An action should consume no noticeable amount of time
Nested substates and guard conditions
‱ A state diagram can be nested inside a state.
– The states of the inner diagram are called substates.
Activity Diagrams
‱ An activity diagram is like a
state diagram.
– Except most transitions are
caused by internal events,
such as the completion of a
computation.
‱ An activity diagram
– Can be used to understand
the flow of work that an
object or component
performs.
– Can also be used to visualize
the interrelation and
interaction between
different use cases.
– Is most often associated with
several classes.
‱ One of the strengths of
activity diagrams is the
representation of concurrent
activities.
Representing concurrency
‱ Concurrency is shown using forks, joins and
rendezvous.
– A fork has one incoming transition and multiple
outgoing transitions.
‱ The execution splits into two concurrent threads.
‱ A rendezvous has multiple incoming and multiple outgoing
transitions.
‱ Once all the incoming transitions occur all the outgoing
transitions may occur.
– A join has multiple incoming transitions and one
outgoing transition.
‱ The outgoing transition will be taken when all incoming
transitions have occurred.
‱ The incoming transitions must be triggered in separate threads.
‱ If one incoming transition occurs, a wait condition occurs at the
join until the other transitions occur.
Swimlanes
‱ Activity diagrams are
most often
associated with
several classes.
‱ The partition of
activities among the
existing classes can
be explicitly shown
using swimlanes.
Implementing Classes Based on
Interaction and State Diagrams
‱ You should use these diagrams for the parts of your
system that you find most complex.
– i.e. not for every class
‱ Interaction, activity and state diagrams help you
create a correct implementation.
‱ This is particularly true when behaviour is distributed
across several use cases.
– E.g. a state diagram is useful when different
conditions cause instances to respond differently to
the same event.
Example
Example
Example: States of the CourseSection class
‱ Planned
– closedOrCancelled == false && open == false
‱ Cancelled
– closedOrCancelled == true && registrationList.size() == 0
‱ Closed (course section is too full, or being taught)
– closedOrCancelled == true && registrationList.size() > 0
‱ Open (accepting registrations)
– open == true
‱ NotEnoughStudents (substate of ‘Open’)
– open == true && registrationList.size() <
course.getMinimum()
‱ EnoughStudents (substate of ‘Open’)
– open == true && registrationList.size() >=
course.getMinimum()
Example code - I
public class CourseSection {
// The many-1 association
private Course course;
// The 1-many association to class Registration
private List registrationList;
// The following are present only to determine the state, the
initial state is Planned
private boolean open = false;
private boolean closedOrCanceled = false;
. . .
}
Example code - II
public CourseSection(Course course){
this.course = course;
registrationList = new LinkedList();
}
public void openRegistration(){
if(!closedOrCanceled) {//must be in Planned
state
open = true; // to OpenNotEnoughStudents
state
}
}
Example code - III
public void closeRegistration(){
// to 'Canceled' or 'Closed' state
open = false;
closedOrCanceled = true;
if (registrationList.size() <
course.getMinimum()){
unregisterStudents(); // to 'Canceled' state
}
}
public void cancel() {
// to 'Canceled' state
open = false;
closedOrCanceled = true;
unregisterStudents();
}
Example code - IV
// Private method to remove all registrations
// Activity associated with 'Canceled' state.
private void unregisterStudents() {
Iterator it = registrationList.iterator();
while (it.hasNext()){
Registration r = (Registration)it.next();
r.unregisterStudent();
it.remove();
}
}
// Called within this package only, by the constructor
of Registration to ensure the link is bi-directional
void addToRegistrationList(Registration
newRegistration) {
registrationList.add(newRegistration);
}
}
Difficulties and Risks in Modelling
Interactions and Behaviour
‱ Dynamic modelling is a difficult skill as in a large
system there are a very large number of possible
paths a system can take.
‱ It is hard to choose the classes to which to allocate
each behaviour:
– Ensure that skilled developers lead the process, and
ensure that all aspects of your models are properly
reviewed.
– Work iteratively:
‱ Develop initial class diagrams, use cases, responsibilities,
interaction diagrams and state diagrams;
‱ Then go back and verify that all of these are consistent,
modifying them as necessary.
‱ Drawing different diagrams that capture related, but distinct,
information will often highlight problems.
Thank You

Mais conteĂșdo relacionado

Mais procurados

Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testingHadi Fadlallah
 
Agile development, software engineering
Agile development, software engineeringAgile development, software engineering
Agile development, software engineeringRupesh Vaishnav
 
Object oriented testing
Object oriented testingObject oriented testing
Object oriented testingHaris Jamil
 
Software engineering lecture notes
Software engineering lecture notesSoftware engineering lecture notes
Software engineering lecture notesSiva Ayyakutti
 
Interaction Modeling
Interaction ModelingInteraction Modeling
Interaction ModelingHemant Sharma
 
Verification and validation process in software testing
Verification and validation process in software testingVerification and validation process in software testing
Verification and validation process in software testingpooja deshmukh
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow TestingHirra Sultan
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagramKaushik Ghosh
 
Software Architecture Design Decisions
Software Architecture Design DecisionsSoftware Architecture Design Decisions
Software Architecture Design DecisionsAfaq Mansoor Khan
 
Etapas de proyectos de software.ppt
Etapas de proyectos de software.pptEtapas de proyectos de software.ppt
Etapas de proyectos de software.pptLuis619096
 
Diagramas de secuencia
Diagramas de secuenciaDiagramas de secuencia
Diagramas de secuenciaLenin Vivanco
 
Unit 1( modelling concepts & class modeling)
Unit  1( modelling concepts & class modeling)Unit  1( modelling concepts & class modeling)
Unit 1( modelling concepts & class modeling)Manoj Reddy
 
Modelado de casos de uso
Modelado de casos de usoModelado de casos de uso
Modelado de casos de usobelleta55
 
Decision table
Decision tableDecision table
Decision tablejeebala
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsAmr E. Mohamed
 
Object Oriented Testing
Object Oriented TestingObject Oriented Testing
Object Oriented TestingAMITJain879
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NETRajkumarsoy
 
Activity diagram
Activity diagramActivity diagram
Activity diagramKaushik Ghosh
 
5.state diagrams
5.state diagrams5.state diagrams
5.state diagramsAPU
 

Mais procurados (20)

Introduction to software testing
Introduction to software testingIntroduction to software testing
Introduction to software testing
 
Agile development, software engineering
Agile development, software engineeringAgile development, software engineering
Agile development, software engineering
 
Object oriented testing
Object oriented testingObject oriented testing
Object oriented testing
 
Software engineering lecture notes
Software engineering lecture notesSoftware engineering lecture notes
Software engineering lecture notes
 
Interaction Modeling
Interaction ModelingInteraction Modeling
Interaction Modeling
 
Verification and validation process in software testing
Verification and validation process in software testingVerification and validation process in software testing
Verification and validation process in software testing
 
Control Flow Testing
Control Flow TestingControl Flow Testing
Control Flow Testing
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Software Architecture Design Decisions
Software Architecture Design DecisionsSoftware Architecture Design Decisions
Software Architecture Design Decisions
 
Etapas de proyectos de software.ppt
Etapas de proyectos de software.pptEtapas de proyectos de software.ppt
Etapas de proyectos de software.ppt
 
Diagramas de secuencia
Diagramas de secuenciaDiagramas de secuencia
Diagramas de secuencia
 
Ooad unit – 1 introduction
Ooad unit – 1 introductionOoad unit – 1 introduction
Ooad unit – 1 introduction
 
Unit 1( modelling concepts & class modeling)
Unit  1( modelling concepts & class modeling)Unit  1( modelling concepts & class modeling)
Unit 1( modelling concepts & class modeling)
 
Modelado de casos de uso
Modelado de casos de usoModelado de casos de uso
Modelado de casos de uso
 
Decision table
Decision tableDecision table
Decision table
 
SE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour DiagramsSE_Lec 09_ UML Behaviour Diagrams
SE_Lec 09_ UML Behaviour Diagrams
 
Object Oriented Testing
Object Oriented TestingObject Oriented Testing
Object Oriented Testing
 
Introduction to ASP.NET
Introduction to ASP.NETIntroduction to ASP.NET
Introduction to ASP.NET
 
Activity diagram
Activity diagramActivity diagram
Activity diagram
 
5.state diagrams
5.state diagrams5.state diagrams
5.state diagrams
 

Destaque

Software Engineering :UML class diagrams
Software Engineering :UML class diagramsSoftware Engineering :UML class diagrams
Software Engineering :UML class diagramsAjit Nayak
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationAjit Nayak
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Ajit Nayak
 
UML Part1-Introduction Mansouri
UML Part1-Introduction MansouriUML Part1-Introduction Mansouri
UML Part1-Introduction MansouriMansouri Khalifa
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagramsartgreen
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagramsMukesh Tekwani
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UMLAjit Nayak
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an IntroductionAjit Nayak
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case DiagramAshesh R
 

Destaque (10)

Software Engineering :UML class diagrams
Software Engineering :UML class diagramsSoftware Engineering :UML class diagrams
Software Engineering :UML class diagrams
 
Software Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & SpecificationSoftware Engineering : Requirement Analysis & Specification
Software Engineering : Requirement Analysis & Specification
 
Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram Software Engineering :Behavioral Modelling - I Sequence diagram
Software Engineering :Behavioral Modelling - I Sequence diagram
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
UML Part1-Introduction Mansouri
UML Part1-Introduction MansouriUML Part1-Introduction Mansouri
UML Part1-Introduction Mansouri
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
Types of UML diagrams
Types of UML diagramsTypes of UML diagrams
Types of UML diagrams
 
Software Engineering : OOAD using UML
Software Engineering : OOAD using UMLSoftware Engineering : OOAD using UML
Software Engineering : OOAD using UML
 
Software Engineering an Introduction
Software Engineering an IntroductionSoftware Engineering an Introduction
Software Engineering an Introduction
 
Use Case Diagram
Use Case DiagramUse Case Diagram
Use Case Diagram
 

Semelhante a Software Engineering :Behavioral Modelling - II State diagram

state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UMLKumar
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagramBaskarkncet
 
Diagrams
DiagramsDiagrams
Diagramsjanessa24
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)Manoj Reddy
 
State chart diagram
State chart diagramState chart diagram
State chart diagramPreeti Mishra
 
Unit three Advanced State Modelling
Unit three Advanced State ModellingUnit three Advanced State Modelling
Unit three Advanced State ModellingDr Chetan Shelke
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! EdholeEdhole.com
 
3 interaction and_state_modeling
3 interaction and_state_modeling3 interaction and_state_modeling
3 interaction and_state_modelingMinal Maniar
 
State Diagram.pdf
State Diagram.pdfState Diagram.pdf
State Diagram.pdfssuser226e3e
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptxssuser2d043c
 
T305 tutorial 4
T305 tutorial 4T305 tutorial 4
T305 tutorial 4hoooma
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1Jenish Bhavsar
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbmsSweta Singh
 
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...European SharePoint Conference
 

Semelhante a Software Engineering :Behavioral Modelling - II State diagram (20)

State modeling
State modelingState modeling
State modeling
 
state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
 
08 state diagram and activity diagram
08 state diagram and activity diagram08 state diagram and activity diagram
08 state diagram and activity diagram
 
Activity diag
Activity diagActivity diag
Activity diag
 
State Diagrams
State DiagramsState Diagrams
State Diagrams
 
Diagrams
DiagramsDiagrams
Diagrams
 
Unit 3(advanced state modeling & interaction meodelling)
Unit  3(advanced state modeling & interaction meodelling)Unit  3(advanced state modeling & interaction meodelling)
Unit 3(advanced state modeling & interaction meodelling)
 
Java
Java   Java
Java
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
 
Unit three Advanced State Modelling
Unit three Advanced State ModellingUnit three Advanced State Modelling
Unit three Advanced State Modelling
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
Free ebooks download ! Edhole
Free ebooks download ! EdholeFree ebooks download ! Edhole
Free ebooks download ! Edhole
 
3 interaction and_state_modeling
3 interaction and_state_modeling3 interaction and_state_modeling
3 interaction and_state_modeling
 
State Diagram.pdf
State Diagram.pdfState Diagram.pdf
State Diagram.pdf
 
STATE DIAGRAM.pptx
STATE DIAGRAM.pptxSTATE DIAGRAM.pptx
STATE DIAGRAM.pptx
 
T305 tutorial 4
T305 tutorial 4T305 tutorial 4
T305 tutorial 4
 
Seminar State Chart1
Seminar State Chart1Seminar State Chart1
Seminar State Chart1
 
States machine
States machineStates machine
States machine
 
Unit 4 dbms
Unit 4 dbmsUnit 4 dbms
Unit 4 dbms
 
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
State Machine Workflow: Esoteric Techniques & Patterns Everyone Should Buy pr...
 

Mais de Ajit Nayak

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testingAjit Nayak
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process ModelsAjit Nayak
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQLAjit Nayak
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part IAjit Nayak
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt IIAjit Nayak
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIIAjit Nayak
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using CAjit Nayak
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLAjit Nayak
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPIAjit Nayak
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementAjit Nayak
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-BasicsAjit Nayak
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockAjit Nayak
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusAjit Nayak
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-NormalisationAjit Nayak
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER ModelAjit Nayak
 
Computer Networks Module III
Computer Networks Module IIIComputer Networks Module III
Computer Networks Module IIIAjit Nayak
 
Computer Networks Module II
Computer Networks Module IIComputer Networks Module II
Computer Networks Module IIAjit Nayak
 
Computer Networks Module I
Computer Networks Module IComputer Networks Module I
Computer Networks Module IAjit Nayak
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIAjit Nayak
 

Mais de Ajit Nayak (20)

Software Engineering : Software testing
Software Engineering : Software testingSoftware Engineering : Software testing
Software Engineering : Software testing
 
Software Engineering : Process Models
Software Engineering : Process ModelsSoftware Engineering : Process Models
Software Engineering : Process Models
 
Database Programming using SQL
Database Programming using SQLDatabase Programming using SQL
Database Programming using SQL
 
Ns2: Introduction - Part I
Ns2: Introduction - Part INs2: Introduction - Part I
Ns2: Introduction - Part I
 
Ns2: OTCL - PArt II
Ns2: OTCL - PArt IINs2: OTCL - PArt II
Ns2: OTCL - PArt II
 
NS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt IIINS2: AWK and GNUplot - PArt III
NS2: AWK and GNUplot - PArt III
 
Socket programming using C
Socket programming using CSocket programming using C
Socket programming using C
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
 
Parallel programming using MPI
Parallel programming using MPIParallel programming using MPI
Parallel programming using MPI
 
Operating Systems Part III-Memory Management
Operating Systems Part III-Memory ManagementOperating Systems Part III-Memory Management
Operating Systems Part III-Memory Management
 
Operating Systems Part I-Basics
Operating Systems Part I-BasicsOperating Systems Part I-Basics
Operating Systems Part I-Basics
 
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & DeadlockOperating Systems Part II-Process Scheduling, Synchronisation & Deadlock
Operating Systems Part II-Process Scheduling, Synchronisation & Deadlock
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Introduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculusIntroduction to database-Formal Query language and Relational calculus
Introduction to database-Formal Query language and Relational calculus
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
Introduction to database-ER Model
Introduction to database-ER ModelIntroduction to database-ER Model
Introduction to database-ER Model
 
Computer Networks Module III
Computer Networks Module IIIComputer Networks Module III
Computer Networks Module III
 
Computer Networks Module II
Computer Networks Module IIComputer Networks Module II
Computer Networks Module II
 
Computer Networks Module I
Computer Networks Module IComputer Networks Module I
Computer Networks Module I
 
Object Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part IIIObject Oriented Programming using C++ Part III
Object Oriented Programming using C++ Part III
 

Último

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar â‰ŒđŸ” Delhi door step de...
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar  â‰ŒđŸ” Delhi door step de...Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar  â‰ŒđŸ” Delhi door step de...
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar â‰ŒđŸ” Delhi door step de...9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Christo Ananth
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 

Último (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar â‰ŒđŸ” Delhi door step de...
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar  â‰ŒđŸ” Delhi door step de...Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar  â‰ŒđŸ” Delhi door step de...
Call Now ≜ 9953056974 â‰ŒđŸ” Call Girls In New Ashok Nagar â‰ŒđŸ” Delhi door step de...
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 

Software Engineering :Behavioral Modelling - II State diagram

  • 1. Software Engineering Principles Ajit K Nayak, Ph.D. ajitnayak@soauniversity.ac.in Behavioural Modelling - II
  • 2. Acknowledgements ‱ Slides of Prof. Rajib Mall, IIT, KGP
  • 3. State Diagram ‱ 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.
  • 4. Event, Condition ‱ Event: something that happens at a point in time – Operator presses self-test button – The alarm goes off ‱ Condition: something that has a duration – The fuel level is high – The alarm is on ‱ State : an abstraction of the attributes and links of an object (or entire system) – The controller is in the state self-test after the self-test button has been pressed and the rest button is not yet pressed. – The tank is in the state too low when the fuel level has been below Ievel-low for alarm-threshold seconds
  • 5. State diagrams – an example ‱ tic-tac-toe game (also called noughts and crosses)
  • 6. State & Transition ‱ 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. ‱ A state is represented by a rounded rectangle containing the name of the state. ‱ Special states: – A black circle represents the start state – A circle with a ring around it represents an end state ‱ A transition represents a change of state in response to an event. – It is considered to occur instantaneously. ‱ The label on each transition is the event that causes the change of state.
  • 9. Activities in state diagrams ‱ An activity is something that takes place while the system is in a state. – It takes a period of time. – The system may take a transition out of the state in response to completion of the activity, – Some other outgoing transition may result in: ‱ The interruption of the activity, and ‱ An early exit from the state.
  • 10. Actions in state diagrams ‱ An action is something that takes place effectively instantaneously – When a particular transition is taken, – Upon entry into a particular state, or – Upon exit from a particular state ‱ An action should consume no noticeable amount of time
  • 11. Nested substates and guard conditions ‱ A state diagram can be nested inside a state. – The states of the inner diagram are called substates.
  • 12. Activity Diagrams ‱ An activity diagram is like a state diagram. – Except most transitions are caused by internal events, such as the completion of a computation. ‱ An activity diagram – Can be used to understand the flow of work that an object or component performs. – Can also be used to visualize the interrelation and interaction between different use cases. – Is most often associated with several classes. ‱ One of the strengths of activity diagrams is the representation of concurrent activities.
  • 13. Representing concurrency ‱ Concurrency is shown using forks, joins and rendezvous. – A fork has one incoming transition and multiple outgoing transitions. ‱ The execution splits into two concurrent threads. ‱ A rendezvous has multiple incoming and multiple outgoing transitions. ‱ Once all the incoming transitions occur all the outgoing transitions may occur. – A join has multiple incoming transitions and one outgoing transition. ‱ The outgoing transition will be taken when all incoming transitions have occurred. ‱ The incoming transitions must be triggered in separate threads. ‱ If one incoming transition occurs, a wait condition occurs at the join until the other transitions occur.
  • 14. Swimlanes ‱ Activity diagrams are most often associated with several classes. ‱ The partition of activities among the existing classes can be explicitly shown using swimlanes.
  • 15. Implementing Classes Based on Interaction and State Diagrams ‱ You should use these diagrams for the parts of your system that you find most complex. – i.e. not for every class ‱ Interaction, activity and state diagrams help you create a correct implementation. ‱ This is particularly true when behaviour is distributed across several use cases. – E.g. a state diagram is useful when different conditions cause instances to respond differently to the same event.
  • 18. Example: States of the CourseSection class ‱ Planned – closedOrCancelled == false && open == false ‱ Cancelled – closedOrCancelled == true && registrationList.size() == 0 ‱ Closed (course section is too full, or being taught) – closedOrCancelled == true && registrationList.size() > 0 ‱ Open (accepting registrations) – open == true ‱ NotEnoughStudents (substate of ‘Open’) – open == true && registrationList.size() < course.getMinimum() ‱ EnoughStudents (substate of ‘Open’) – open == true && registrationList.size() >= course.getMinimum()
  • 19. Example code - I public class CourseSection { // The many-1 association private Course course; // The 1-many association to class Registration private List registrationList; // The following are present only to determine the state, the initial state is Planned private boolean open = false; private boolean closedOrCanceled = false; . . . }
  • 20. Example code - II public CourseSection(Course course){ this.course = course; registrationList = new LinkedList(); } public void openRegistration(){ if(!closedOrCanceled) {//must be in Planned state open = true; // to OpenNotEnoughStudents state } }
  • 21. Example code - III public void closeRegistration(){ // to 'Canceled' or 'Closed' state open = false; closedOrCanceled = true; if (registrationList.size() < course.getMinimum()){ unregisterStudents(); // to 'Canceled' state } } public void cancel() { // to 'Canceled' state open = false; closedOrCanceled = true; unregisterStudents(); }
  • 22. Example code - IV // Private method to remove all registrations // Activity associated with 'Canceled' state. private void unregisterStudents() { Iterator it = registrationList.iterator(); while (it.hasNext()){ Registration r = (Registration)it.next(); r.unregisterStudent(); it.remove(); } } // Called within this package only, by the constructor of Registration to ensure the link is bi-directional void addToRegistrationList(Registration newRegistration) { registrationList.add(newRegistration); } }
  • 23. Difficulties and Risks in Modelling Interactions and Behaviour ‱ Dynamic modelling is a difficult skill as in a large system there are a very large number of possible paths a system can take. ‱ It is hard to choose the classes to which to allocate each behaviour: – Ensure that skilled developers lead the process, and ensure that all aspects of your models are properly reviewed. – Work iteratively: ‱ Develop initial class diagrams, use cases, responsibilities, interaction diagrams and state diagrams; ‱ Then go back and verify that all of these are consistent, modifying them as necessary. ‱ Drawing different diagrams that capture related, but distinct, information will often highlight problems.