Rajib Mall Pose
Rajib Mall Pose
12/30/2021 1
About The Instructor
RAJIB MALL
3
What is Software Engineering?
Engineering approach to develop
software.
Building Construction Analogy.
Systematic collection of past
experience:
Techniques,
Methodologies,
Guidelines. 4
Techniques versus Methodology…
Many times used interchangeably…
Dictionary:
Technique: a systematic procedure, formula,
or a routine by which a task is accomplished.
Method: A habitual, logical, or prescribed
practice or a preordained sequence of achieving
certain end results with accuracy and
efficiency.
However, when a method is systematic and based
5
upon logic, it is referred to as a scientific method.
Jobs versus Projects?
Uncertainty
Routine of outcome
routine…
IEEE Definition
“Software engineering is the
application of a systematic,
disciplined, quantifiable approach
to the development, operation, and
maintenance of software; that is,
the application of engineering to
software.”
7
Technology Development Pattern
Programming an Art
or Engineering? Engineering
Esoteric Past
Experience
Technology
Unorganized Use of
Art Past Experience
Time 8
Programming an Art or Engineering?
Heavy use of past experience:
Pastexperience is systematically
arranged.
Theoretical basis and quantitative
techniques provided.
Many are just thumb rules.
Tradeoff between alternatives.
Pragmatic approach to cost-
effectiveness. 9
What is Exploratory Development?
Early programmers used an
Fix
Initial
Test
Coding Do Until
Done
Machine
cost
Program Size 12
Dilbert: Scott Adams 13
Our Project Manager: Ponty Haired Boss
Hopelessly
incompetent at
management. He
does not understand
technical issues but
always tries to
disguise this, usually
by using buzzwords
that he does not
understand himself.
Often lacks Ethics…
14
15
Dogbert
Consultant ---
Low on ethics--- Loves
conning and insulting
people---
When hired as a consultant
to create a new company
logo, Dogbert proposed
using a piece of paper with
Dilbert a circular stain from his
coffee cup as the Brown
Competent --- Ring of Quality.
Bit arrogant – Low on Ethics 16
17
18
19
Asok graduated from the Indian
Institute of Technology (IIT). Asok's
test scores (a perfect 1600 on the old
SAT) and the fact his IQ is 240, show
that he is the smartest member of the
engineering team. He is often called
upon by the Boss to do odd jobs and
his ideas are usually left hanging in the
meetings. There are a few jokes about
him having psychic powers which he
learned at the IIT. Yet despite his
intelligence, ethics and mystical
powers, Asok sometimes takes advice
from Wally in the arts of laziness, and
20
Dilbert in surviving the office.
21
22
What is Wrong with the Exploratory Style?
Cont…
size of required
software
becomes large?
24
Program Size
An Interpretation Based on Human
Cognition Mechanism
Human memory can be thought to
be made up of two distinct parts
[Miller 56]:
Short term memory and
Processing Center
Brain 27
Short Term Memory
An item stored in the short term
memory can get lost:
Either due to decay with time or
Displacement by newer information.
This restricts the time for which an
item is stored in short term memory:
Typically few tens of seconds.
However, an item can be retained longer
28
in the short term memory by recycling.
What is an Item?
An item is any set of related information.
A character such as `a' or a digit such as `5'.
A word, a sentence, a story, or even a picture.
Each item normally occupies one place in
memory.
When you are able to relate several
different items together (chunking):
The information that should normally occupy
several places, takes only one place in memory.
29
Chunking
If you are given the binary number
110010101001
It
may prove very hard for you to
understand and remember.
But,the octal form of 6251
(110)(010)(101)(001) would be easier.
Youhave managed to create chunks of
three items each. 30
Evidence of Short Term Memory
In many of our day-to-day experiences:
Short term memory is evident.
Suppose, you look up a number from the
telephone directory and start dialling it.
If you find the number is busy, you can dial
the number again after a few seconds without
having to look up the directory.
But, after several days:
You may not remember the number at all
Would need to consult the directory again. 31
The Magical Number 7
If a person deals with seven or less
number of items:
These would be accommodated in the
short term memory.
So, he can easily understand it.
As the number of new information
increases beyond seven:
It
becomes exceedingly difficult to
understand it.
32
What is the Implication in Program
Development?
A small program having just a few variables:
Is within easy grasp of an individual.
Decomposition
35
What is Abstraction?
Simplify a problem by omitting
unnecessary details.
Focus attention on only one
aspect of the problem and
ignore other aspects and
irrelevant details.
Also called model building. 36
Questions
What is a model?
39
Does a Problem have a single Abstraction?
Species
Homo Solanum Coprinus
Sapien Tuberosum Comatus
43
Decomposition
Decompose a problem into many small
independent parts.
Thesmall parts are then taken up one
by one and solved separately.
The idea is that each small part would
be easy to grasp and therefore can be
easily solved.
Thefull problem is solved when all the
parts are solved. 44
Decomposition
A popular use of decomposition
principle:
Try to break a bunch of sticks tied
together versus breaking them
individually.
Any arbitrary decomposition
of a problem may not help.
The decomposed parts must be more or
45
less independent of each other.
Decomposition Example
Example use of decomposition
principle:
You understand a book better
when the contents are organized
into independent chapters.
Compared to when everything is
mixed up. 46
Why Study Software
Engineering? (1)
To acquire skills to develop large
programs.
Handlingexponential growth in
complexity with size.
Systematic techniques based on
abstraction (modelling) and
decomposition. 47
Why Study Software Engineering? (2)
To acquire skills to be a
better programmer:
Higher Productivity
49
Software Crisis
It is often the case that software
products:
Fail to meet user requirements.
Expensive.
28% Successful
49% Delayed or
cost overrun
23% Cancelled
52
Then why not have entirely
hardware systems?
A virtue of software:
Relatively easy to change
Otherwise it might as well be hardware
The more the complexity of a
software (Entropy), the harder it is to
change--why?
Further, the more the changes made
to a program, the greater is the
increase in its entropy.
53
Which Factors are Contributing to the
Software Crisis?
Larger problems,
Custom software-Developer
tailors his generic solution
57
Types of Software Projects
58
Software Services
Software service is an umbrella
term, includes:
Software customization
Software maintenance CP
Software testing
Alsocontract programmers
who carry out coding or any
other assigned activities. 59
Scenario of Indian Software
Companies
60
A Few Changes in Software Project
Characteristics over Last 40 Years
40 years back, very few software existed
Every project started from scratch
Projects were multi year long
The programming languages that were used
hardly provided any scope for reuse:
FORTRAN, PASCAL, COBOL, BASIC
No application was GUI-based:
Mostly command selection from displayed text
menu items.
61
Traditional versus Modern Projects
Projects are increasingly becoming services:
Either tailoring some existing software or reusing
certain pre-built libraries.
Facilitation and accommodation of client
feedbacks
Facilitation of customer participation in project
development work
Incremental software delivery with evolving
functionalities.
No software being developed from scratch --
62
- Significant reuse
Computer Systems Engineering
Computer systems engineering:
encompasses software engineering.
Many products require development of
software as well as specific hardware
to run it:
a coffee vending machine,
a sophisticated toy,
A new smart phone, etc. 63
Computer Systems Engineering
64
Computer Systems Engineering (CONT.)
Feasibility
Study
Requirements
Analysis and
Specification Hardware
Development
Hardware
Software
Partitioning Software
Development
Integration
and Testing
Project Management
66
Emergence of Software Engineering
Thisreduced software
development efforts greatly.
Why reduces?
69
High-Level Language Programming
(Early 60s)
70
Control Flow-Based Design (late 60s)
Programmers found:
Verydifficult to write cost-effective
and correct programs. 71
Control Flow-Based Design (late 60s)
indicates:
The sequence in which the program's
instructions are executed.
To help design programs having good
control structure:
Flow charting technique was
developed. 73
Control Flow-Based Design (late 60s)
75
Control Flow-Based Design (Late 60s)
It was found:
GO TO statements makes control
structure of a program messy.
78
Control-flow Based Design (Late 60s)
80
Control Flow-Based Design (Late 60s)
It soon was conclusively proved:
Everyone accepted:
It is possible to solve any
programming problem without using
GO TO statements.
This formed the basis of Structured
Programming methodology.
82
Structured Programming
A program is called structured:
When it uses only the following
types of constructs:
sequence,
selection,
iteration
83
Structured Programs
Unstructured control flows are
avoided.
Consist of modules.
Use single-entry, single-exit
program constructs.
84
Structured Programs
However, violations to this
feature are permitted:
Dueto practical considerations
such as:
86
Structured Programming
Research experience shows:
Programmers commit less number
of errors:
While using structured if-then-else
and do-while statements.
Compared to test-and-branch
constructs. 87
Data Structure-Oriented Design
(Early 70s)
Jackson's Structured
Programming(JSP) methodology
JSP technique:
91
Data Structure Oriented Design
(Early 70s)
JSP methodology:
93
Data Flow-Oriented Design
(Late 70s)
95
Data Flow-Oriented Design (Late 70s)
Partly
Assembled
Chassis with Car
Engine
97
Object-Oriented Design (80s)
Object-oriented technique:
An intuitively appealing design
approach:
Simplicity
Easy maintenance
100
Evolution of Design Techniques
Aspect- Component- Service-
oriented based oriented
Object-Oriented
Object-Oriented
Data flow-based
Data structure-
based
Control flow-
based
Ad hoc
101
Evolution of Other Software
Engineering Techniques
The improvements to the software
design methodologies
are indeed very conspicuous.
Specification techniques,
Project management techniques,
Testing techniques,
Debugging techniques,
Quality assurance techniques,
Metrics,
CASE tools, etc. 103
Differences between the exploratory style
and modern software development practices
Coding,
In exploratory style,
errors are detected only during
testing,
Now:
Focus is on detecting as many errors
as possible in each phase of
development.
106
Differences between the exploratory style
and modern software development practices
(CONT.)
In exploratory style:
codingis synonymous with program
development.
Now:
codingis considered only a small
part of program development
107
effort.
Differences between the exploratory style
and modern software development practices
(CONT.)
scheduling,
monitoring mechanisms.
4
Software Life Cycle
Conceptualize
Specify
Retire
Design
Maintain
Deliver Code
Test 5
Life Cycle Model
A software life cycle model (also
process model or SDLC):
A descriptive and diagrammatic model of
software life cycle:
Identifies all the activities undertaken during
product development,
Establishes a precedence ordering among the
different activities,
Divides life cycle into phases. 6
Life Cycle Model (CONT.)
CodeTest Design
Reality:
Documentation of all aspects of
software development are needed to
help in operation and maintenance.
18
Life Cycle Model (CONT.)
Design,
Coding,
Testing
20
Maintenance.
Classical Waterfall Model
Classical waterfall model divides life
cycle into following phases:
Feasibility study,
Requirements analysis and specification,
Design,
Conceptualize
Retire Specify
Test 21
Maintenance.
Classical Waterfall Model
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
22
Relative Effort for Phases
Phases between feasibility
study and testing 60
Called development phases. 50
40
Relative Effort
Among all life cycle phases
30
Maintenance phase 20
consumes maximum effort. 10
Among development 0
Maintnce
Design
Test
Coding
Req. Sp
phases,
Testing phase consumes the
maximum effort. 23
Classical Waterfall Model (CONT.)
Measure of how
suitable system
Four feasibility
development will
tests:
be to the
company Schedule
feasibility
Economic
feasibility
(also called Technical
cost/benefit feasibility
feasibility)
30
Feasibility Study Activities
Assesses
feasibility
of each
alternative
solution
Presented to
Recommends steering
the most committee,
feasible which decides
solution for how system will
the project be developed
31
Activities during Feasibility Study
Perform a cost/benefit analysis:
Determine which solution is the best.
May also find that none of the
solutions is feasible due to:
high cost,
resource constraints,
technical reasons.
32
Cost benefit analysis (CBA)
Need to identify all costs --- these
could be:
Development costs
Set-up
Operational costs
Identify the value of benefits
Req. Analysis
Design
Coding
Testing
Maintenance
34
Requirements Analysis and Specification
Aim of this phase:
Understand the exact requirements
of the customer,
Document them properly.
Why?
Req. Analysis
Design
Design
Coding
Testing
Maintenance
41
Design
During design phase requirements
specification is transformed into :
A form suitable for implementation
in some programming language.
42
Design
In technical terms:
Duringdesign phase, software
architecture is defined.
Two commonly used design
approaches:
Traditional approach,
Object oriented approach. 43
Traditional Design Approach
44
Structured Analysis (CONT.)
pay-roll register,
47
Departments, etc.
Object Oriented Design (CONT.)
Object structure
Further refined to obtain the
detailed design.
OOD has several advantages:
Lower development effort,
Lower development time,
Better maintainability. 48
Classical Waterfall Model
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
49
Coding and Unit Testing
During this phase:
Req. Analysis
Design
Coding
Testing
Maintenance
51
Integration and System Testing
Different modules are integrated in a
planned manner:
Modulesare usually integrated through
a number of steps.
During each integration step,
thepartially integrated system is
tested.
M1 M2 M5 M7
M3 M4 M6 M8
52
System Testing
After all the modules have been
successfully integrated and tested:
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
54
Maintenance
Maintenance of any software:
Req. Analysis
Design
Coding
Testing
Maintenance
63
Phase Containment of Errors
Errors should be detected: (Cont...)
65
Phase Containment of Errors
Reason: rework must be carried out not only
to the design but also to code and test
phases.
The principle of detecting errors as close
to its point of introduction as possible:
is known as phase containment of errors.
Iterative waterfall model is by far the most
widely used model.
Almost every other model is derived from the
waterfall model. 66
Waterfall Strengths
Easy to understand, easy to use
Provides a reference to inexperienced
staff
Milestones are well understood by the
team
Provides requirements stability
Facilitates strong management control
67
(plan, staff, track)
Waterfall Deficiencies
All requirements must be known
upfront
Deliverables created for each phase
are considered frozen – inhibits
flexibility
Can give a false impression of progress
Integration is one big bang at the end
Little opportunity for customer to pre-
68
view the system.
When to use the Waterfall Model?
Requirements are well known and
stable
Technology is understood
69
Classical Waterfall Model
(CONT.)
Metaphor of mathematical
theorem proving:
A mathematician presents a proof
as a single chain of deductions,
Even though the proof might have
come from a convoluted set of partial
attempts, blind alleys and backtracks.
71
Quiz
What problems may be encountered if a project
manager recommends use of the iterative
waterfall model for a customization project?
Give one example project situation for which
waterfall model is suitable.
Give one example project situation for which
waterfall model is not suitable.
What is a milestone? Give one example of a
milestone.
In what way are milestones useful?
How frequently should milestones be placed? 72
Quiz
Suppose the sales manager of your company
informs the top management of your
company that he sees tremendous potential
for a wearable health monitor:
The wearable health monitor would measure
vital body parameters such as heart rate,
temperature, blood pressure, etc and maintain
a log.
12/30/2021 74
V Model
It is a variant of the Waterfall
emphasizes verification and validation
V&V activities are spread over the
entire life cycle.
Product System&
Requirements& Acceptance
Specification Testing
Analysis
Architecture Integration&
High Level Testing
Design
Detailed Unit
Design testing
Coding 76
V Model Steps
Planning
Easy to use 78
V Model Weaknesses
Does not support overlapping of
phases
12/30/2021 81
Prototyping Model
A derivative of waterfall model.
Before starting actual development,
A working prototype of the system
should first be built.
A prototype is a toy implementation of
a system:
Limited functional capabilities,
Low reliability,
82
Inefficient performance.
Reasons for prototyping
learning by doing: useful where
requirements are only partially known
improved communication
improved user involvement
reduces the need for documentation
reduces maintenance costs i.e. changes
after the application goes live 83
Reasons for Developing a Prototype
Illustrate to the customer:
inputdata formats, messages, reports, or
interactive dialogs.
prototype:
It
is impossible to “get it right”
the first time,
We must plan to throw away the
first version:
If we want to develop a good
software.
85
Prototyping Model (CONT.)
Build Prototype
Refine
Requirements Implement
Test
Maintain88
Prototyping Model (CONT.)
Susceptible to over-engineering:
92
94
Source: Robert Martin
Major difficulties of Waterfall-Based Life
Cycle Models
96
Evolutionary
Model
12/30/2021 97
Evolutionary Model
Evolutionary model (aka successive versions
or incremental model):
The system is broken down into several modules
which can be incrementally implemented and
delivered.
First develop the core modules of the
software.
The initial skeletal software is refined into
increasing levels of capability:
By adding new functionalities in successive 98
versions.
Biological Systems
99
Biological Systems
The waterfall model did not apply to
biological systems --- these evolved instead
of being designed.
100
12/30/2021 © 2009 Bahill
Evolutionary Model
“A complex system will be most successful
if implemented in small steps… “retreat”
to a previous successful step on failure…
opportunity to receive some feedback
from the real world before throwing in all
resources… and you can correct possible
errors…” Tom Glib in Software Metrics
101
Evolutionary Model (CONT.)
functioning
systems capable of
performing some useful work.
A new release may include new
functionality:
Also existing functionality in the
current release might have been
enhanced.
102
Evolutionary Model
Evolves an initial implementation with user
feedback:
Multiple versions until the final version.
Initial
Specification version
Outline
Intermediate
description
Development versions
Final
Validation version
12/30/2021 103
Advantages of Evolutionary Model (1)
Users get a chance to experiment with a
partially developed system:
Much before the full working version is
released,
12/30/2021 107
Customer’s Perspective
A AB A
B B
108
Incremental Model
Combines the ideas from Waterfall and
Evolutionary Model.
Final
System
109
Slice
Slice
Slice
Slice
Slice
Slice
Slice
Slice
Slice
High Level Analysis
Incremental Model
Slice
Slice
110
Slice
Incremental Model
Waterfall: single release
Iterative: many releases (increments)
First increment: core functionality
Successive increments: add/fix functionality
Final increment: the complete product
112
The incremental process
Design increment
113
R Waterfall
D
C
T
One Iteration
R
R
D Evolutionary
R
C
D Model With
R Iteration
D
T C
D
C
T
C
T
T
Time
R:Requirement Analysis
D:Design
114
C:Coding, Unit Testing
Which step first?
Some steps will be pre-requisite because of
physical dependencies
Others may be in any order
Value to cost ratios may be used
V/C where
116
Incremental and
Iterative
Development (IID)
Model
12/30/2021 117
“The basic idea… take advantage of what was
being learned during the development of
earlier, incremental, deliverable versions of
the system. Learning comes from both the
development and use of the system… Start
with a simple implementation of a subset of
the software requirements and iteratively
enhance the evolving sequence of versions. At
each version design modifications are made
along with adding new functional capabilities. “
Victor Basili
118
Incremental and Iterative
Development (IID)
Key characteristics
Consists of a planned number of iterations
Each iteration produces a working program
12/30/2021 124
Rapid Application Development
(RAD) Model
Sometimes referred to as the rapid
prototyping model.
Major aims:
Decrease the time taken and the cost incurred
to develop software systems.
Facilitate accommodating change requests as
early as possible:
Before large investments have been made in
development and testing. 125
Important Underlying Principle
• A way to reduce development time
and cost, and yet have flexibility
to incorporate changes:
Interfaces).
Applications for Which RAD is
Suitable
•Customized product developed for
one or two customers only
12/30/2021 137
What is Agile Software Development?
139
Agile Model
To overcome the shortcomings of the
waterfall model of development.
Proposed in mid-1990s
Video
conversation
Modeling
Phone Options
conversation
Videotape
Email
conversation
Audiotape
Documentation
Options
Paper
Cold Hot
Richness of Communication Channel
Copyright 2002-2005 Scott W. Ambler 150
Original Diagram Copyright 2002 Alistair Cockburn
Agile Model: Principles
The primary measure of progress:
Incremental release of working software
Important principles behind agile model:
Frequent delivery of versions every few weeks.
All change requests to the requirements are
accommodated easily.
Close cooperation between customers and
developers.
Face-to-face communication among the
development team members. 151
Agile Documentation
Travel light:
You need far less documentation than you think.
Agile documents:
Are concise
Describe information that is less likely to change
Describe “good things to know”
Are sufficiently accurate, consistent, and detailed
Valid reasons to document:
Your project stakeholders require it
To define a contract model
To support communication with an external group
To think something through 152
Agile Software Requirements Management
High
{ Each iteration implement the highest-
Priority priority requirements
Requirements may be
reprioritized at any time
Requirements may be
removed at any time
Low
Priority 153
Requirements Copyright 2004 Scott W. Ambler
Adoption Detractors
Lack of theoretical grounding
Inconsistent and diverse definitions
High quality people skills required
Short iterations inhibit long-term
perspective
Higher risks:
Harderto manage feature creep and
customer expectations
Difficult to quantify cost, time, quality.
154
Agile Model Shortcomings
Derive agility through developing
tacit knowledge in the team, rather
than any formal document:
Can be misinterpreted…
External review difficult to get…
When project is complete, and team
disperses, maintenance becomes
difficult…
155
Agile vs. Plan-Driven Processes
1. Small products and 1. Large products and
teams: teams;
Scalability limited hard to scale down
2. Untested on safety- 2. Proven for highly critical
critical products products;
3. Good for dynamic, 3. Good for stable:
but expensive for But expensive for dynamic
stable environments. environments
4. Require experienced 4. Require only few
personnel throughout experienced personnel
5. Personnel thrive on 5. Personnel thrive on
freedom and chaos
structure and order 156
Agile Model versus Iterative Waterfall
Model
The waterfall model steps through in a planned
sequence over
Requirements-capture, analysis, design, coding, and
testing stages:
Progress is measured in terms of delivered
artifacts:
Requirement specifications, design documents, test
plans, code reviews, etc.
In contrast agile model sequences:
Delivery of working versions of a product in several
157
increments.
Agile Model versus
Iterative Waterfall Model
As regards to similarity:
We can say that Agile teams
use the waterfall model on a
small scale.
158
Agile versus RAD Model
Agile model does not recommend developing
prototypes:
Systematic development of each incremental
feature is emphasized.
In contrast:
RAD is based on designing quick-and-dirty
prototypes, which are then refined into
production quality code.
Agile projects logically break down the
solution into a number of features:
These are incrementally developed and 159
delivered.
Agile versus exploratory programming
Similarity:
12/30/2021 161
Extreme Programming
If architecture is important,
everybody will work at defining and
refining the architecture (metaphor)
Inception Phase
Elaboration Phase
Construction Phase
Transition Phase
183
RUP Iterations in Phases
The duration of and iteration may vary from
two weeks or less.
Iterations Iterations Iterations Iterations
184
Unified process
software
increment
Communication inception
Deployment Planning
transition elaboration
Construction Modeling
construction
185
Unified process work products
186
Structure of RUP Process
Two dimensions.
Horizontal axis:
Represents time and shows the
lifecycle aspects of the process as it
unfolds.
Vertical axis:
Represents core process workflows. 187
Two dimensions of RUP
188
Inception activities
Formulate scope of project
Synthesize a candidate
architecture. 189
Outcome of Inception Phase
Initial requirements capture
193
Transition Phase
The transition phase consists of the transfer
of the system to the user community
Includes shipping, installation, training, technical
support and maintenance
202
Scrum: Characteristics
Self-organizing teams
Product progresses in a series of month-
long “sprints”
Requirements are captured as items in a
list of “product backlog”
No specific engineering practices
prescribed
Uses generative rules to create an agile
environment for delivering projects
One of the “agile processes”
203
How Scrum Works?
204
Sprints
Scrum projects make progress in a series
of “sprints”
Analogous to XP iterations
206
207
No changes during the sprint
Change
209
Key Roles and Responsibilities in Scrum Process
Product Owner
Acts on behalf of customers to represent
their interests.
Development Team
Team of five-nine people with cross-functional
skill sets.
Scrum Master (aka Project Manager)
Facilitates scrum process and resolves
impediments at the team and organization level
by acting as a buffer between the team and
outside interference. 210
Product Owner
Define the features of the product
Decide on release date and content
Responsible for the profitability of the
product (ROI)
Prioritize features according to market
value
Adjust features and priority every
iteration, as needed
211
Accept or reject work results.
The Scrum Master
Represents management to the project
Removes impediments
Ensure that the team is fully functional and
productive
Enable close cooperation across all roles and
functions
Shield the team from external interferences212
Scrum Team
Typically 5-10 people
Cross-functional
QA, Programmers, UI Designers, etc.
Sprint
Daily Scrum
214
Spring Planning Meeting
Product Backlog
Team Capabilities
Sprint Goal
Sprint Planning
Business Conditions
Meeting Sprint Backlog
Technology
Current Product
215
Parts of Sprint Planning Meeting
1st Part:
Creating Product Backlog
Determining the Sprint Goal.
2nd Part:
Participants: Scrum Master, Scrum Team
Creating Sprint Backlog 216
Pre-Project/Kickoff Meeting
A special form of Sprint Planning
Meeting
217
Sprint
• Fundamental process flow of Scrum
• A short, fixed-length period of time
• Goal is to produce Backlog Items into renewable
products that Stakeholders can provide feedback
on
• Sprint Planning allows the PO to work with the
Team to negotiate what Backlog Items the Team
will work on in order to meet Release Goals
• Scrum Master ensures Team agrees to realistic
goals 218
Sprint
A month-long iteration, during which is
incremented a product functionality
15-minutes
Stand-up
Three questions:
1. What did you do yesterday
Informal
2-hour prep time rule
Participants
Customers
Management
Product Owner
223
Other engineers
Sprint Retrospective Meeting
Scrum Team only
Feedback meeting
Three questions
Start
Stop
Continue
Usually a combination of
227
From Sprint Goal to Sprint Backlog
Scrum team takes the Sprint Goal and
decides what tasks are necessary
Team self-organizes around how they’ll
meet the Sprint Goal
Manager doesn’t assign tasks to individuals
230
Sprint Backlog
No more than 300 tasks in the list
231
Sample Sprint Backlog
232
Burn down Charts
Are used to represent “work done”.
Are wonderful Information Radiators
3 Types:
Sprint Burn down Chart (progress of the
Sprint)
5/
3/
2
0
100
200
300
400
500
600
700
800
900
5/ 00
5/ 2
2
5/ 002
7/
2
752
5/ 00
9/ 2
5/ 200
11 2
5 / /2 0
762
13 02
/
5/ 200
664
15 2
/
5/ 200
17 2
5 / /2 0
Progress
619
19 02
/
5/ 200
Date
21 2
304
5 / /2 0
23 02
/
5/ 200
25 2
5 / /2 0
264
27 02
/
5/ 200
180
29 2
5 / /2 0
31 02
/2
00
2
104
20
Sprint Burndown Chart
235
Release Burndown Chart
Will the release be done on right
time?
X-axis: sprints
237
Scalability of Scrum
A typical Scrum team is 6-10 people
239
Scalability of Scrum
240
Thanks
241
Feasibility Analysis and Bidding
242
243
244
245
Requirements Analysis
and Specification
Prof. R. Mall
Dept. of CSE, IIT, Kharagpur
1
Requirements Analysis and Specification
5
6
Dilbert: Scott Adams
Dilbert: Scott Adams 7
Activities in Requirements
Analysis and Specification
Requirements Gathering
Requirements Analysis
Requirements Specification
8
Requirements Engineering Process
Feasibility
Study Requirements
gathering
Requirements
analysis
Feasibility Requirements
report specification
SRS Document
9
Dilbert: Scott Adams 10
Requirements Analysis and Specification
● Requirements Gathering:
– Fully understand the user requirements.
● Requirements Analysis:
– Removeinconsistencies, anomalies, etc.
from requirements.
● Requirements Specification:
– Documentrequirements properly in an
SRS document. 11
Dilbert: Scott Adams 12
Need for SRS…
● Good SRS reduces development cost
– Req. errors are expensive to fix later
– Req. changes cost a lot (typically 40%)
– Good SRS can minimize changes and errors
– Substantial savings --- effort spent during
req. saves multiple times that effort
Cost
● An Example:
– Cost of fixing errors in req. , design , coding ,
acceptance testing and operation are 2 , 5 , 15
, 50 , 150 person-months 13
Uses of SRS Document
● Establish the basis for agreement
between the customers and the suppliers
● Provides starting point for development.
● Provide a basis for estimating costs and
schedules.
● Provide a baseline for validation and
verification.
● Facilitates transfer.
● Serves as a basis for enhancement. 14
Forms Basis for User Manual
● The SRS can serve as the basis for
writing User Manual for the software:
SRS Document 17
Dilbert: Scott Adams
18
How to Gather Requirements?
● Observe existing (manual) systems,
● Study existing procedures,
● Discuss with customer and end-
users,
● Analyse what needs to be done
● Input and Output analysis
19
Requirements Gathering Activities
● 2. Interview
● 3. Task analysis
● 4. Scenario analysis
● 5. Form analysis
20
Dilbert: Scott Adams 21
Requirements Gathering (CONT.)
● In the absence of a working
system,
– Lotof imagination and creativity
are required.
● Interacting with the customer to
gather relevant data:
– Requires a lot of experience.
22
Requirements Gathering (CONT.)
23
Dilbert: Scott Adams 24
Case Study: Automation of
Office Work at CSE Dept.
● The academic, inventory, and financial
information at the CSE department:
– Being carried though manual processing by two
office clerks, a store keeper, and two
attendants.
● Considering the low budget he had at his
disposal:
– The HoD entrusted the work to a team of
student volunteers. 25
Case Study: Automation of Office
Work at CSE Dept.
● The team was first briefed by the HoD:
– Concerning the specific activities to be
automated.
● The analysts first discussed with the two
office clerks: Interview
34
Analysis of the Gathered
Requirements (CONT.)
Input
Data S Output
Data
42
SRS Document (CONT.)
43
SRS Document (CONT.)
● Easy to change.,
– i.e. it should be well-structured.
● It should be consistent.
● It should be complete. 45
Properties of a Good SRS Document
(cont...)
● It should be traceable
– Youshould be able to trace which
part of the specification
corresponds to which part of the
design, code, etc and vice versa.
● It should be verifiable
– e.g.
“system should be user friendly” is
not verifiable 46
SRS should not include...
● Project development plans
– E.g. cost, staffing, schedules, methods, tools, etc
● Lifetime of SRS is until the software is made obsolete
● Lifetime of development plans is much shorter
● Designs
– Requirements and designs have different audiences
47
– Analysis and design are different areas of expertise
A Badly Written Gigantic Document is a Pain to Users
● Hardware interfaces
● Software interfaces
– 1.2 Scope
– 1.3 Definitions. Acronyms, and Abbreviations
•Define the vocabulary of the
– 1.4 References SRS (may reference appendix)
● Index 58
IEEE 830-1998 Standard – Section 2 of SRS
● Title •Present the business case and operational concept of the system
•Describe how the proposed system fits into the business context
● Table of Contents
•Describe external interfaces: system, user, hardware, software, communication
•Describe constraints: memory, operational, site adaptation
● 1. Introduction
•Summarize the major functional capabilities
● 2. Overall Description •Include the Use Case Diagram and supporting narrative
(identify actors and use cases)
– 2.1 Product Perspective •Include Data Flow Diagram if appropriate
● 5. Index 59
IEEE 830-1998 Standard – Section 3 of SRS (1)
● …
● 1. Introduction Specify software requirements in sufficient
requirements
● 3. Specific Requirements
State requirements that are externally perceivable by
– 3.1 External Interfaces users, operators, or externally connected systems
Requirements should include, at a minimum, a description
– 3.2 Functions of every input (stimulus) into the system, every output
(response) from the system, and all functions performed
● 3. Specific Requirements
•Include detailed specifications of each
– 3.1 External Interfaces use case, including collaboration and
other diagrams useful for this purpose
– 3.2 Functions
•Include:
– 3.3 Performance Requirements a) Types of information used
b) Data entities and their relationships
SafeHome Software
● an author’s name:
– Output:
● R1.2:
– Input: key words
– Output: Details of all books whose title or author
name matches any of the key words.
● Details include: Title, Author Name, Publisher name, Year
of Publication, ISBN Number, Catalog Number, Location
in the Library.
● R2.2:
– Input: membership number and password
– Output:
● list of the books borrowed by user are displayed. User prompted to enter
books to be renewed or
● user informed about bad password
● Contradictions:
– Contradictions might arise
● if the same thing described at several places in88
different ways.
Examples of Bad SRS
● Ambiguity:
Documents
– Literary expressions
– Unquantifiable aspects, e.g. “good user
interface”
● Forward References:
– References to aspects of problem
● defined only later on in the text.
● Wishful Thinking:
– Descriptions of aspects
89
– Checklists. 95
What is the difference between a System
Specification and a Software Specification?
● Decision trees
● Decision tables
105
Decision Trees
● Decision trees:
– Edges of a decision tree represent
conditions
– Leafnodes represent actions to be
performed.
● A decision tree gives a graphic view of:
– Logic involved in decision making
– Corresponding actions taken. 106
Example: LMS
– Cancel membership.
107
Example: LMS
108
Example(cont.)
● If proper information is entered,
–A membership record for the member is
created
–A bill is printed for the annual
membership charge plus the security
deposit payable.
109
Example(cont.)
● If the renewal option is chosen,
– LMSasks the member's name and his
membership number
● checks whether he is a valid member.
– If the name represents a valid member,
● the membership expiry date is updated and
the annual membership bill is printed,
● otherwise an error message is displayed.
110
Example(cont.)
● If the cancel membership option is
selected and the name of a valid
member is entered,
– The membership is cancelled,
–A cheque for the balance amount due to
the member is printed
– The membership record is deleted.
111
Decision Tree
- Get details
- Create record
- Print bills
New member
- Get Details
User Renewal - Update record
input - Print bills
Cancel
- Get Details
- Print Cheque
- Delete record
Invalid option
115
Example
● Conditions
Valid selection NO YES YES YES
New member -- YES NO NO
Renewal -- NO YES NO
Cancellation -- NO NO YES
● Actions
Display error message -- -- --
– set theoretic
– algebraic specification
– finite state machines, etc.
119
Formal Specification
● Advantages:
– Well-defined semantics, no scope
for ambiguity
– Automated tools can check
properties of specifications
– Executable specification
120
Formal Specification
● Disadvantages of formal
specification techniques:
– Difficult to learn and use
– Notable to handle complex
systems
121
Semiformal Specification
● Structured specification languages
– SADT (Structured Analysis and Design
Technique)
– PSL/PSA (Problem Statement
Language/Problem Statement Analyzer)
● PSL is a semi-formal specification
language
● PSA can analyze the specifications
expressed in PSL 122
Executable Specification Language
● If specification is expressed in formal
language:
– it
becomes possible to execute the
specification to provide a system
prototype.
130
Assignment
● A public library is considering the
implementation of a computer-based
system to help administer book loans at
libraries.
Prof. R. Mall
Dept. of CSE, IIT, Kharagpur
What does designer do during
design phase?
• Transform SRS document to
Design document:
A form easily implementable in some
programming language.
SRS Design
Document Design Documents
Activities
Items Designed During Design
Phase
• Module structure,
• Control relationship among the modules
call relationship or invocation relationship
• Interface among different modules,
data items exchanged among different
modules,
• Data structures of individual modules,
• algorithms for individual modules.
Module
• A module consists of:
several functions
associated data structures.
D1 ..
D2
D3
..
..
Data
F1 ..
F2 .. Functions
F3 ..
F4 ..
F5 ..
Module Structure
Iterative Nature of Design
• Identify:
modules
control relationships among modules
interfaces among modules.
d1 d2
d3 d1 d4
High-level design
• Understandability of a design is a
major issue:
Largely determines goodness of
design:
a design that is easy to understand:
also easy to maintain and change.
What Is Good Software
Design?
Superior
Inferior
urce
3-layer architectures of
applications
Presentation layer
Application processing
layer
Data management
layer
Modularity
• In technical terms, modules
should display:
high cohesion
low coupling.
• We nexts discuss:
cohesion and coupling.
Modularity
• Arrangement of modules in a
hierarchy means:
low fan-out
abstraction
Coupling: Degree of dependence
among components
functional
sequential
communicational
Degree of
procedural cohesion
temporal
logical
coincidental
Coincidental cohesion
Print-inventory();
Register-Student();
Issue-Book();
};
Logical cohesion
• All elements of the module perform
similar operations:
e.g. error handling, data input, data
output, etc.
• An example of logical cohesion:
a set of print functions to generate an
output report arranged into a single
module.
Logical Cohesion
Module print{
void print-grades(student-file){ …}
void print-certificates(student-file){…}
void print-salary(teacher-file){…}
}
Temporal cohesion
• The module contains tasks so that:
all the tasks must be executed in the
same time span.
• Example:
The set of functions responsible for
initialization,
start-up, shut-down of some process,
etc.
Temporal Cohesion – Example
init() {
Check-memory();
Check-Hard-disk();
Initialize-Ports();
Display-Login-Screen();
}
Procedural cohesion
handle-Student- Data() {
Static Struct Student-data[10000];
Store-student-data();
Search-Student-data(); Function A
Print-all-students(); Function B
}; Function C
Communicational
Access same data
Sequential cohesion
search
display
Functional cohesion
• Different elements of a module
cooperate:
to achieve a single function,
e.g. managing an employee's pay-roll.
• When a module displays functional
cohesion,
we can describe the function using
a single sentence.
Determining Cohesiveness
• Coupling indicates:
how closely two modules interact
or how interdependent they are.
The degree of coupling between
two modules depends on their
interface complexity.
Coupling
• There are no ways to precisely measure
coupling between two modules:
classification of different types of coupling
will help us to approximately estimate the
degree of coupling between two modules.
data
stamp
control Degree of
coupling
common
content
Data coupling
• Essentially means:
low fan-out
abstraction
Characteristics of Module
Structure
• Depth:
number of levels of control
• Width:
overall span of control.
• Fan-out:
a measure of the number of modules
directly controlled by given module.
Characteristics of Module
Structure
• Fan-in:
indicates how many modules
directly invoke a given module.
High fan-in represents code
reuse and is in general
encouraged.
Module Structure
Fan out=2
Fan out=1
Fan in=1
Fan in=2
Fan out=0
Goodness of Design
• Lower-level modules:
do input/output and other low-
level functions.
• Upper-level modules:
do more managerial functions.
Abstraction
f1
f2 d1 d2
f3
• d3 d4
• d1
fn
Design Approaches
• In OOD:
state information is not shared
in a centralized data.
but is distributed among the
objects of the system.
Example:
• In an employee pay-roll system, the
following can be global data:
names of the employees,
their code numbers,
basic salaries, etc.
• Whereas, in object oriented systems:
data is distributed among different
employee objects of the system.
Object-Oriented versus Function-
Oriented Design
• class detector
• attributes: status, location, neighbors
• operations: create, sense-status, get-location,
• find-neighbors
• class alarm
• attributes: location, status
• operations: create, ring-alarm, get_location,
• reset-alarm
• In a function-oriented program :
the system state is centralized
several functions accessing these
data are defined.
• In the object oriented program,
the state information is distributed
among various sensor and alarm
objects.
Object-Oriented versus Function-
Oriented Design
Prof. R. Mall
Dept. of CSE, IIT, Kharagpur
1
Introduction
● Structured analysis is a modelling technique:
– DFD (Data Flow Diagram) is the modelling
technique used
– Technically
known as top-down
decomposition.
5
SA/SD (Structured
Analysis/Structured Design)
● SA/SD technique draws heavily from the
following methodologies:
– Constantine and Yourdon's methodology
– Hatley and Pirbhai's methodology
– Gane and Sarson's methodology
– DeMarco and Yourdon's methodology
● SA/SD technique can be used to perform
– high-level design. 6
Functional Decomposition
● Each function is analyzed:
– Hierarchically
decomposed into
more detailed functions.
– Simultaneous decomposition of
high-level data
● Into more detailed data.
7
Structured Analysis
● Textual problem description
converted into a graphic model.
● Module structure:
Play-
move
0.3 13
DFD Concepts
● It is useful to consider each
function as a processing
station:
– Each function consumes some
input data.
– Produces some output data.
14
Data Flow Model of a Car
Assembly Unit
Partly
Assembled
Car
Fit Paint
Fit Fit and
Engine Doors Wheels
Chassis Assembled Test
with Car Car
Engine
15
Data Flow Diagrams (DFDs)
● A DFD model:
18
Data Flow Diagrams (DFDs)
● Primitive Symbols Used for Constructing DFDs:
19
External Entity Symbol
● Represented by a rectangle
25
Synchronous Operation
● If two bubbles are directly
connected by a data flow arrow:
– They are synchronous
26
Asynchronous Operation
● If two bubbles are connected via a
data store:
– They are not synchronous.
Read- Validate-
numbers numbers
0.1 0.2
Valid
numbers number
Data-items
27
Yourdon's vs. Gane Sarson Notations
● The notations that we are following:
– Are closer to the Yourdon's notations
Data Store
ID
# External
External Entity External
Entity
Entity 29
How is Structured Analysis Performed?
● Initially represent the software at
the most abstract level:
Tic-tac-toe
display software
move
Human Player
31
Context Diagram
● A context diagram shows:
– External entities.
● Data sources
● Data sinks. 33
Level 1 DFD Construction Display
game
move -board
0.1 result
● Examine the SRS
Check-
document: Validate
-move board
winner
0.4
0.2
– Between 3 to 7 bubbles. 36
Decomposition
● Too few bubbles make
decomposition superfluous:
– Ifa bubble is decomposed to
just one or two bubbles:
● Then this decomposition is
redundant. 37
Decomposition
● Too many bubbles:
– More than 7 bubbles at any
level of a DFD.
– Make the DFD model hard
to understand.
38
Decompose How Long?
● Decomposition of a bubble
should be carried on until:
–A level at which the function
of the bubble can be
described using a simple
algorithm. 39
Example 1: RMS Calculating Software
Data-
items Compute-
RMS
0
User result
Context Diagram
42
Example 1: RMS Calculating
Software
Read- Validate-
numbers numbers
0.1 0.2
Valid -
Data-items numbers
error
Display Compute-
0.4 rms
0.3
result RMS
45
Example 1: RMS Calculating
Software
Squared-
Calculate- sum
squared-sum Calculate-
0.3.1 mean
0.3.2
Valid - Mean-
numbers square
Calculate-
root
0.3.3
46
RMS
Example: RMS Calculating
Software
b
c
Square Square Square
0.3.1.1 0.3.1.2 0.3.1.3
bsq
asq csq
Sum
0.3.1.4
Squared-sum
47
Example: RMS Calculating
Software
● Decomposition is never carried
on up to basic instruction level:
–A bubble is not decomposed any
further:
● If it can be represented by a
simple set of instructions.
48
Data Dictionary
● A DFD is always accompanied by a data
dictionary.
● A data dictionary lists all data items appearing
in a DFD:
– Definition of all composite data items in terms of
their component data items.
– All data names along with the purpose of the data
items.
● For example, a data dictionary entry may be:
– grossPay = regularPay+overtimePay
49
Importance of Data Dictionary
● Provides all engineers in a project with
standard terminology for all data:
–A consistent vocabulary for data is very
important
● = represents equivalence,
– e.g. a=b+c means that a represents b
and c.
out.
Balancing a DFD
c
b c
c1
d1
a d
e
Level 1 d e1
e
Level 2
59
Numbering of Bubbles
● Number the bubbles in a DFD:
– Numbers help in uniquely identifying any bubble
from its bubble number.
● Bubbles at level 1:
– Numbered 0.1, 0.2, 0.3, etc
Tic-tac-toe
display software
0
move
Human Player
63
Level 1 DFD
game
Display-
move board
0.1 result
Validate- Check-
move winner
0.2 board 0.4
Play-
move
0.3 64
Data Dictionary
● Display=game + result
● move = integer
● board = {integer}9
● game = {integer}9
● result=string
65
Example 3: Trading-House
Automation System (TAS)
● A large trading house wants us to
develop a software:
– To automate book keeping activities
associated with its business.
order Generate-
response indent
Customer Purchase-
Department
76
Level 1 DFD
Customer-history Item-file
query
Handle-
indent- Sales-statistics
Indent-
request request
0.4
Indents Material-issue-
pending-order slip + bill
77
Example: Data Dictionary
● response: [bill + material-issue-slip, reject-message]
● query: period /* query from manager regarding sales statistics*/
● period: [date+date,month,year,day]
● date: year + month + day
● year: integer
● month: integer
● day: integer
● order: customer-id + {items + quantity}*
● accepted-order: order /* ordered items available in inventory */
80
Observation
● As a DFD is refined into greater
levels of detail:
– The analyst performs an implicit
functional decomposition.
Generate
Error message
Check
number number
number
[found,not-found]
Search
86
Find 4 Errors
item query
inventory statistics
Item-file Handle-
query
0.3
Process-
order
0.2
statistics
Handle-
indent-
request Sales-statistics
0.4
Material-issue-slip87+
pending-order bill
Common Mistakes in Constructing DFDs
inventory
Customer-file Accept-
order
order Process-
Accepted-orders
order
94
Shortcomings of the DFD Technique
● A DFD does not specify
synchronization aspects:
– Forinstance, the DFD in TAS example
does not specify:
● Whether process-order may wait until the
accept-order produces data
● Whether accept-order and handle-order
may proceed simultaneously with some
buffering mechanism between them.
95
Shortcomings of the DFD Model
● Decomposition is carried out to arrive at the
successive levels of a DFD is subjective.
● The ultimate level to which decomposition is
carried out is subjective:
– Depends on the judgement of the analyst.
● Even for the same problem,
– Several alternative DFD representations are
possible:
– Many times it is not possible to say which DFD
representation is superior or preferable. 96
Shortcomings of the DFD Model
● DFD technique does not provide:
– Any clear guidance as to how exactly one should
go about decomposing a function:
– One has to use subjective judgement to carry
out decomposition.
● Structured analysis techniques do not
specify when to stop a decomposition
process:
– To what length decomposition needs to be
carried out. 97
DFD Tools
● Several commercial and free tools
available.
● Commercial:
– Visio
– Smartdraw (30 day free trial)
– Edraw
– Creately
– Visual analyst
● Free:
– Dia (GNU open source) 98
Word of Caution
● Tools can be easily learned and used.
Process-order
102
Arrows
● An arrow between two modules
implies:
– During execution control is passed
from one module to the other in the
direction of the arrow.
root
order
Process-order
104
Library Modules
● Library modules represent frequently
called modules:
– A rectangle with double side edges.
– Simplifies drawing when a module is
called by several modules.
Quick-sort
105
Selection
● The diamond symbol represents:
– One module of several modules
connected to the diamond symbol is
invoked depending on some condition.
root
rms
rms
Valid-numbers
Valid-numbers
Get-data Validate-
data
110
Bad Design
111
Shortcomings of Structure Chart
● By looking at a structure chart:
– wecan not say whether a module calls
another module just once or many
times.
● else p= 80 dummy
● while(p>20) yes no
115
Transform Analysis
● The first step in transform
analysis:
– Divide the DFD into 3 parts:
● input,
● logical processing,
● output. 116
Transform Analysis
● Input portion in the DFD:
– processes which convert input data from
physical to logical form.
– e.g.
read characters from the terminal
and store in internal tables or lists.
● Each input portion:
– called an afferent branch.
– Possible
to have more than one afferent
117
branch in a DFD.
Transform Analysis
● Output portion of a DFD:
– transforms output data from logical form
to physical form.
● e.g., from list or array into output characters.
– Each output portion:
● called an efferent branch.
● Finally check:
– Whether all bubbles have been mapped to
modules. 122
Example 1: RMS Calculating
Software
Data-items
Compute-
RMS
0
User result
Context Diagram
123
Example 1: RMS Calculating
Software
● From a cursory analysis of the problem
description,
– easyto see that the system needs to
perform:
● accept the input numbers from the user,
● validate the numbers,
● calculate the root mean square of the input
numbers,
124
● display the result.
Example 1: RMS Calculating Software
numbers
Read- Validate-
numbers numbers
0.1 0.2
Valid -
Data- numbers
items error
Compute-
Display rms
0.4 0.3
result RMS
125
Example 1: RMS Calculating
Software
● By observing the level 1 DFD:
– Identifyread-number and
validate-number bubbles as the
afferent branch
– Display as the efferent branch.
126
Example 1: RMS Calculating
Software
root
rms
rms
Valid-numbers
Valid-numbers
Data
Valid-numbers
Data
Get-data Validate-
data
127
Example 2: Tic-Tac-Toe Computer
Game
● As soon as either of the human player or
the computer wins,
– A message congratulating the winner should
be displayed.
● If neither player manages to get three
consecutive marks along a straight line,
– And all the squares on the board are filled up,
– Then the game is drawn.
● The computer always tries to win a game. 128
Context Diagram for
Example 2
Tic-tac-toe
display software
0
move
Human Player
129
Level 1 DFD
game
Display-
move board
result
Validate- Check-
move board winner
Play-
move
130
Structure Chart
root
Validate- Check-
move winner
131
Transaction Analysis
● Useful for designing transaction
processing programs.
– Transform-centered systems:
● Characterized by similar processing steps for
every data item processed by input, process,
and output bubbles.
– Transaction-driven systems,
● One of several possible paths through the
DFD is traversed depending upon the input
132
data value.
Transaction Analysis
● Transaction:
– Any input data value that triggers an
action:
– Forexample, selected menu options might
trigger different functions.
– Represented by a tag identifying its type.
● Transaction analysis uses this tag to
divide the system into:
– Several transaction modules
133
– One transaction-center module.
Transaction analysis
Transaction-
center
trans 3
trans 1
trans 2
134
Level 1 DFD for TAS
Customer-history Item-file
query
Handle-
indent- Sales-statistics
Indent- request
request
Indents
pending-order 135
Structure Chart
root
order query
indent
Accept- Process-
Get-order order
order
136
Summary
● We discussed a sample function-oriented
software design methodology:
– Structured Analysis/Structured
Design(SA/SD)
– Incorporates features from some important
design methodologies.
order Generate-
response indent
Customer Purchase-
Department
3
Level 1 DFD
Customer-history Item-file
query
Handle-
indent- Sales-statistics
Indent-
request request
0.4
Indents Material-issue-
pending-order slip + bill
4
Partial Data Dictionary
response: [bill + material-issue-slip, reject-message]
query: period /* query from manager regarding sales statistics*/
period: [date+date,month,year,day]
date: year + month + day
year: integer
month: integer
day: integer
order: customer-id + {items + quantity}*
accepted-order: order /* ordered items available in inventory */
Rectangular box:
A rectangular box represents a
module.
Annotated with the name of the
module it represents.
Process-order
8
Arrows
An arrow between two modules implies:
During execution control is passed from
one module to the other in the direction
of the arrow. root
order
Process-order 10
Library Modules
Library modules are the frequently
called modules:
A rectangle with double side edges.
Simplifies repeated drawing when a
module is called by several modules.
Quick-sort
11
Selection
The diamond symbol represents:
One module of several modules
connected to the diamond symbol is
invoked depending on some
condition. root
rms
rms
Valid-numbers
Valid-numbers
Get-data Validate-
data
16
Bad Design
17
Shortcomings of Structure Chart
By looking at a structure chart:
yes no
if(c == 100) C==100
P=20 P=80
P=20
dummy
else p= 80 yes no
P>20
while(p>20)
Print
19
print(student mark)
Flow Chart versus Structure Chart
A structure chart differs from a flow
chart in three principal ways:
1. It is difficult to identify modules of a
software from its flow chart
representation.
2. Data interchange among the modules is
not represented in a flow chart.
3. Sequential ordering of tasks inherent in
a flow chart is suppressed in a
20
structure chart.
Transformation of a DFD Model
into Structure Chart
Transaction Analysis
21
Transform Analysis
afferent branch,
efferent branch.
25
Transform Analysis
Identifying the highest level input and
output transforms:
requires experience and skill.
Some guidelines:
Trace inputs until a bubble is found whose
output cannot be deduced from the inputs
alone.
Processes which validate input are not central
transforms.
Processes which sort input or filter data from
26
it are.
Transform Analysis
root
First level of structure chart:
Drawa box for input and
output units input transform
Output
Data-items Compute-
RMS
0
User result
Context Diagram
29
Example 1: RMS Calculating Software
From a cursory analysis of the
problem description,
easyto see that the system needs to
perform:
accept the input numbers from the user,
validate the numbers,
calculate the root mean square of the
input numbers,
display the result. 30
Example 1: RMS Calculating Software
numbers
Read- Validate-
numbers numbers
0.1 0.2
Valid -
Data- numbers
items error
Compute-
Display rms
0.4 0.3
result RMS
31
Example 1: RMS Calculating
Software
rms
rms
Valid-numbers
Valid-numbers
Get-data Validate-
data 33
Example 2: Tic-Tac-Toe Computer Game
As soon as either of the human player or
the computer wins,
A message congratulating the winner should
be displayed.
If neither player manages to get three
consecutive marks along a straight line,
And all the squares on the board are filled up,
Then the game is drawn.
The computer always tries to win a game. 34
Context Diagram for Example 2
Tic-tac-toe
display software
0
move
Human Player
35
Level 1 DFD
game
Display-
move board
result
Validate- Check-
move board winner
Play-
move
36
Structure Chart
root
Transaction-driven systems,
One of several possible paths through the
DFD is traversed depending upon the input
38
data value.
Transaction Analysis
Transaction:
Any input data value that triggers an
action:
Forexample, a menu option selection
might trigger a set of functions.
Represented by a tag identifying its type.
Transaction analysis uses this tag to
divide the system into:
Several transaction modules
39
One transaction-center module.
Transaction analysis
Transaction-
center
trans 3
trans 1
trans 2
40
Level 1 DFD for TAS
Customer-history Item-file
query
Handle-
indent- Sales-statistics
Indent- request
request
Indents
pending-order 41
Structure Chart
root
order query
indent
Handle-order Handle-indent Handle-query
reference-
books
issue-books
members register
45
Objects
A system is designed as a set of interacting
objects.
Objects are often real-world entities:
Examples: an employee, a book etc.
Can also be conceptual objects :
Controller, manager, etc.
m1 m6
Data
m2 m5
Class
m3 m4 50
Encapsulation
James Rumbaugh et al., 1991
“Amechanism by which external aspects
of a class that are visible to or accessible
by other objects are separated from the
internal or implementation details of
these aspects.”
Grady Booch, 1994
“…Serves to separate the contractual
interface of an abstraction and its
implementation.” 51
Information Hiding
m3
m5
m1
m4
m3
m5
m2 Data
m6
m1
Methods
Concept of encapsulation 55
Encapsulation Vs Information Hiding
Encapsulation is a concept
Encapsulation
is implemented by
Information hiding.
56
Class
Template for object creation:
Instantiated into objects
An abstract data type (ADT)
Examples: Employees, Books, etc.
Sometimes not intended to produce
instances:
Abstract classes 57
UML Class Representation
A class represents a set of objects having
similar attributes, operations, relationships and
behavior.
Class Name
Window
A class can
size: Size implicitly
Inline Attributes have a few
visibility: boolean association
attributes
display()
Operations
hide()
58
Example UML Classes
LibraryMember LibraryMember LibraryMember
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
59
Different representations of the LibraryMember class
Active Class
The nature of objects as self-
contained entities make them suitable
for concurrent implementation.
An active class is just like any other
class:
Except that behavior of its objects is
concurrent with other objects.
Indicates implementation as one or more
processes or threads. 60
Active Class
Represented as a class with
double lines on the left and right.
EventManager
suspend()
flush()
61
Class Attribute Examples
Java Syntax UML Syntax
Private Student
-Students[0..MAX_Size]:Student
students[0..MAX_Size]
62
Visibility Syntax in UML
public public +
protected protected #
package ~
private private -
63
Methods vs. Messages?
Methods are the operations
supported by an object:
Means for manipulating the data of
an object.
Invokedby sending a message
(method call).
Examples:
calculate_salary, issue-
book, member_details, etc. 64
Method Examples
65
Are Methods and Messages
Synonyms?
No
Message was the original
concept in object-orientation…
Methods are the later
simplifications…
Sometimes used as synonyms 66
Are Methods and Operations
Synonyms?
No
Association
Aggregation/Composition
Dependency 68
Inheritance
Allows to define a new class LibraryMember Base Class
Represents generalization-
UnderGrad PostGrad Research
specialization relationship.
Allows redefinition of the existing
methods (method overriding). 69
Inheritance
Animal
Dog
70
Hmmm… not really…
71
Source: Robert Martin
Inheritance
Lets a subclass inherit attributes
and methods from a base class.
LibraryMember Base Class
Derived
Faculty Students Staff
Classes
73
Employee anEmployee = new Employee();
Objects myRectangle and myBox
Rectangle myRectangle = new Rectangle(5, 3);
Box myBox = new Box(6, 5, 4);
height 4.0
74
A Generalization Example
Mammal Quadruped
Feline Lizard
Person
attributes
operations
Any problems?
76
76
Inheritance Example
Library
Book
issuable reference
Issuable Reference
Issuable Reference
Single Volume Single Volume
BookSet BookSet
Book Book
Female #3
role
<<abstract>>
Person Nurse
Gender
Male #1 patient
#2 Physical-
therapist
Impractical
Patient
78
#2 78
Multiple Inheritance
cont…
LibraryMember Base Class LibraryMember Base Class
Derived
Faculty Students Staff Faculty Students Staff
Classes
Multiple
Inheritance
V. Ramesh
691205-5678
People Tax_files
1 1
People Associated with Tax_files
83
Multiple Association – example
motherOf
Bhim
motherOf
Kunti Yudhistir
motherOf
Arjun
Women People
1 *
Women Mother of People
84
Association UML Syntax
role B
Class A Class B
role A
employee
Person employer
Company
works for
85
Association Name
Association - More Examples
1 borrowed by *..5
Library Member Book
* eats * Human
Lion
86
Navigability
opens 0..5
Key * Door
87
Association – Multiplicity
A teacher teaches 1 to 3 courses (subjects)
Each course is taught by only one teacher.
A student can take between 1 to 5 courses.
A course can have 10 to 300 students.
1 teaches 1..3
Teacher Course
1..5
takes
Students
10..300 88
Quiz: Draw Class Diagram
A Student can take up to five Courses.
90
Student credits hasEnrolmentOf
Course
10..300 Enrols in 1..5
* opens 0..5
Key Door
92
Association and Link
A link:
An instance of an association
Exists between two or more objects
Dynamically created and destroyed as
the run of a system proceeds
For example:
An employee joins an organization.
Leavesthat organization and joins a new
93
organization etc.
Association Relationship
A class can be associated with itself
(recursive association).
Give an example?
Person Friend of
95
Self Association: Example 0
Computer Network
Connects to
Computer *
96
Computer Network: Object
Diagram
Node4
Node5
next
LinkedListNode
previous
98
Reflexive Association: Example 2
Course
*
*
has pre-requisite of
99
Implementing Association
Relationship: Example 1
• To implement in Java:
– Use a reference variable of one class as
an attribute of another class
Bookname: OOSD
abook Author: Gamaa
ISBN: 12234434
100
public class Member{
private Book book;
public issueBook(Book abook){
setBook(abook);
abook.setLender(this);
}
setBook(Book abook){
book=abook;
} 1 1
Borrowed
… Member Book
by
}
101
public class Book{
private Member member;
setLender(Member aLender){
member=aLender;
}
… 1 1
Borrowed Book
} Member
by
102
Association Implementation:
Example 2
Student credits hasEnrolmentOf
Course
1..300 enrols 1..5
employee
Person employer
Company
works for
Association Name
}
Code for Association Multiplicity
class Customer{
private ArrayList <Account> accounts =
new ArrayList<Account>();
public Customer() {
Account defaultAccount = new Account();
accounts.add(defaultAccount);
}
} has
Customer 1 1..* Account106
1-1 Association Example 3
1 has 1
Advertiser Account
}
Quiz: Read and understand
UML class diagram
has
CPU 1 Controller
0..2
1..4 1
DiskDrive controls SCSIController
CPU myCPU;
}
class SCSIController extends Controller {
DiskDrive [ ] myDrives = new DiskDrive[4];
}
Class DiskDrive {
SCSIController mySCSI;
}
110
Quiz: Banking System
Bank
has 1
*
Account
Audit() :void
1 borrowed by *
Library Member Book
employed by 1
Employee * Company
112
Object-Oriented
Software Design
19501) in 2004.
Schematic Object-Oriented Solution
reference-
books
issue-books
members register
3
Objects
A system is designed as a set of interacting
objects.
Objects are often real-world entities:
Examples: an employee, a book etc.
m1 m6
Data
m2 m5
Class
m3 m4 8
Encapsulation
James Rumbaugh et al., 1991
“Amechanism by which external aspects
of a class that are visible to or accessible
by other objects are separated from the
internal or implementation details of
these aspects.”
Grady Booch, 1994
“…Serves to separate the contractual
interface of an abstraction and its
implementation.” 9
Information Hiding
m3
m5
Methods
of concerns principle. 12
Encapsulation
cont…
m4
m3
m5
m2 Data
m6
m1
Methods
Concept of encapsulation 13
Encapsulation Vs Information Hiding
Encapsulation is a concept
Encapsulation is implemented by
Information hiding. 14
Class
Template for object creation:
Instantiated into objects
An abstract data type (ADT)
Examples: Employees, Books, etc.
Sometimes not intended to produce
instances:
Abstract classes 15
UML Class Representation
A class represents a set of objects having
similar attributes, operations, relationships
and behavior.
Class Name
Window
A class can
size: Size implicitly
Attributes have a few
visibility: boolean association
attributes
display()
Operations hide()
16
Example UML Classes
LibraryMember LibraryMember LibraryMember
issueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
17
Different representations of the LibraryMember class
Active Class
The nature of objects as self-
contained entities make them suitable
for concurrent implementation.
An active class is just like any other
class:
Except that behavior of its objects is
concurrent with other objects.
Indicates implementation as one or more
processes or threads. 18
Active Class
Represented as a class with double
lines on the left and right.
EventManager
suspend()
flush()
19
Servers and active objects
Servers:
Implemented as a parallel process with entry
points corresponding to object operations.
If no calls are made to it, the object
suspends itself and waits for further
requests for service.
Active objects:
Objects are implemented as parallel
processes and the internal object state may
be changed by the object itself and not
simply by external calls. 20
Class Attribute Examples
Java Syntax UML Syntax
Private Student
-Students[0..MAX_Size]:Student
students[0..MAX_Size]
21
Visibility Syntax in UML
public public +
protected protected #
package ~
private private -
22
Methods vs. Messages?
Methods are the operations
supported by an object:
Means for manipulating the data of
an object.
Invokedby sending a message
(method call).
Examples:
calculate_salary, issue-
book, member_details, etc. 23
Method Examples
24
Are Methods and Messages
Synonyms?
No
Message was the original
concept in object-orientation…
Methods are the later
simplifications…
Sometimes used as synonyms 25
Are Methods and Operations
Synonyms?
No
Association
Aggregation/Composition
Dependency 27
Inheritance
Allows to define a new class LibraryMember Base Class
Represents generalization-
specialization relationship.
UnderGrad PostGrad Research
Animal
Dog
29
Hmmm… not really…
30
Inheritance
Lets a subclass inherit attributes
and methods from a base class.
LibraryMember Base Class
Derived
Faculty Students Staff
Classes
Derived
Faculty Students Staff Faculty Students Staff
Classes
Multiple
Inheritance
33
Employee anEmployee = new Employee();
Objects myRectangle and myBox Rectangle
Mammal Quadruped
Feline Lizard
Person
attributes
operations
Any problems?
36
36
Inheritance Example
Library
Book
issuable reference
Issuable Reference
Issuable Reference
Single Volume Single Volume
BookSet BookSet
Book Book
Female #3
role
<<abstract>>
Person Nurse
Gender
Male #1 patient
#2 Physical-
therapist
Patient
Poor Model 38
#2 38
Inheritance Pitfalls
Inheritance certainly promotes
reuse.
Indiscriminate use can result in
poor quality programs.
Base class attributes and methods
visible in derived class…
Leads to tight coupling 39
Association Relationship
How implemented in program?
V. Ramesh
691205-5678
Keshab Parhi
People Tax_files
1 1
People Associated with Tax_files
42
Multiple Association – example
motherOf
Bhim
motherOf
Kunti Yudhistir
motherOf
Arjun
Women People
1 *
Woman Mother of People
43
Association UML Syntax
role B
Class A Class B
role A
44
Association Name
Association - More Examples
1 borrowed by *..5
Library Member Book
* eats * Human
Lion
opens 0..5
Key * Door
46
Association – Multiplicity
A teacher teaches 1 to 3 courses (subjects)
Each course is taught by only one teacher.
A student can take between 1 to 5 courses.
A course can have 10 to 300 students.
1 teaches 1..3
Teacher Course
1..5
takes
Students
10..300
47
Quiz: Draw Class Diagram
A Student can take up to five Courses.
49
Identify as Correct or Wrong
opens 0..5
* Door
Key
51
Association and Link
A link:
An instance of an association
Exists between two or more objects
Dynamicallycreated and destroyed as
the run of a system proceeds
For example:
An employee joins an organization.
Leavesthat organization and joins a new
52
organization etc.
Association Relationship
A class can be associated with itself
(recursive association).
Give an example?
*
Person *
Friend of
54
Self Association: Example 0
Computer Network
Connects to
Computer *
55
Computer Network: Object
Diagram
Node4
Node5
next
LinkedListNode
previous
57
Reflexive Association: Example 2
Course
*
*
has pre-requisite of
58
Implementing Association
Relationship: Example 1
• To implement in Java:
– Use a reference variable of one class as
an attribute of another class
Bookname: OOSD
abook Author: Gamaa
ISBN: 12234434
1 Borrowed by 1
Bookname: abook Member Book
memberName: AKK
Member Number: 412323
59
public class Member{
private Book book;
public issueBook(Book abook){
setBook(abook);
abook.setLender(this);
}
setBook(Book abook){
book=abook;
} 1 1
Borrowed
… Member Book
by
}
60
public class Book{
private Member member;
setLender(Member aLender){
member=aLender;
}
… 1 1
Borrowed Book
} Member
by
61
Association Implementation:
Example 2
Student credits hasEnrolmentOf
Course
1..300 enrols 1..5
Association Name
}
Code for Association Multiplicity
class Customer{
private ArrayList <Account> accounts =
new ArrayList<Account>();
public Customer() {
Account defaultAccount = new Account();
accounts.add(defaultAccount);
}
} has
Customer 1 1..* Account 65
1-1 Association Example 3
1 has 1
Advertiser Account
}
Quiz: Read and understand
UML class diagram
has
CPU 1 Controller
0..2
1..4 1
DiskDrive controls SCSIController
CPU myCPU;
}
class SCSIController extends Controller {
DiskDrive [ ] myDrives = new DiskDrive[4];
}
Class DiskDrive {
SCSIController mySCSI;
}
69
Quiz: Banking System
Bank
has 1
*
Account
Audit() :void
1 borrowed by *
Library Member Book
employed by 1
Employee * Company
71
Quiz 1: Write Java Code
1 issues 1
Book Member
Source code? ? ?
72
Quiz 2: Draw UML Class Diagram
public class TreeMap {
TreeMapNode topNode = null;
public void add(Comparable key, Object value) {…}
public Object get(Comparable key) {…}
}
class TreeMapNode {
private Comparable itsKey;
private Object itsValue;
private TreeMapNode nodes[] = new TreeMapNode[2];
Source code? ? ?
public class Book {
private Member member;
public issue(Member m) {
member = m; }
public Member issuedTo() {
return member; }
} 74
Quiz 2: UML Class Diagram Solution
2 nodes
TreeMap TreeMapNode
topNode
+ add(key,value) + add(key,value)
+ get(key) + find(key)
itsKey <<interface>>
Comparable
<<interface>>
itsValue
Object
75
public class Company {
Recapture:
private Person employee;
public void setCompany(Person p){ Association
employee=p; Implementation
p.setWorksFor(this);}
} Do you see any problems
public class Person { with this code?
private Company employer;
public Company getWorksFor() {
return employer; Company 1 works 1
Person
} employer employee
class symbol:
Attached to the association symbol by
a dashed line.
An association class:
Samename as the association
because...
It represents the same thing! 79
Association Class: Example 1
Server 1 Connection * Client
Connection
baudRate
protocol
total Cost
• These attributes don’t belong
Disconnect
reportUsage to either the Client or Server
rerouteLink class.
• They are attributes of the
connection itself.
Class
Mark: Integer Mark: Integer
Class
Diagram
Diagram
:Module :Student
:Module :Student
:Registration :Registration
Mark = 76 Mark = 76
:Student
:Student
:Registration :Registration
Object Object
Diagram Mark = 89 Diagram
Mark = 89
82
Pass the
Java Code Student to
public class Module { Registration.
private Vector <Registration> reg=new Vector<Registration>();
public void enrol(Student st) {
reg.addElement( new Registration(st) );
}
... Maintain the link
to Registration
}
class Registration { Module Student
private Student student; 1
* Registration
private int mark; Mark: Integer
Registration(Student st) {
student = st; mark = 0; Keep track of
the Student
} reference.
...
} 83
Association Class: Example 4
RealEstate 1 *
Developer Client
An association Contract
class is a
“normal” class,
Amount
and may include
Contract #
relations,
Date
inheritance etc.
84
public class RealEstateDeveloper{
private Vector <Contract> contracts= new Vector
<Contract>();
public void buy(Client c){contracts.add(new Contract(c))};
}
public class Client{
private Address address;
public Address getCurrentAddress(){}
}
public class Contract{
private Client client;
private int contractNo;
public Contract(Client c){ client=c;} 85
Ternary Association
An object of an association class:
Man Woman
1 1
marry
1..3
Priest
Man 1
Marriage 1 1 Woman
1
Participates
Participates
in
in
*
Performed by
1..3
Priest
88
Record
Goals against
Goals for
Player 11 1
Team
*
Season
89
Association Quiz
Book Editor
title: String * 1 name: String
Edited by
editor: String myBooks: Book
1
Insurance Company * Insurance Contract
* *
{or}
1..* 1..*
Person Company
92
Qualified Association
A qualified association allows us to restrict the
objects referred in an association.
Modelled by associative arrays, maps, and
dictionaries.
1
GradeCard Roll
0..1
Student
Read
1
0..1
Directory file
name File
How to read?
There exists upto one file for each instance of93
filename in the directory .
What does it Mean?
There is at most one Product for each
instance of Order Line in the Order.
1
0..1 Product
Order Order Line
Refers to
1 * Product
Order Refers to
1 0..1
League nickName Player
Association Name
employer
Person employee
works for empId Company
0..1
1 97
Qualified Association
1
0..1
Bank accno Account
99
Code Example
Hash Table is another choice to implement the index, it
provides synchronized access.:
public class Bank{
private HashTable theAccounts;
Aggregation
Composition 101
Overdoing Associations
Avoid unnecessary Associations
PersonInfo PersonInfo
Person 1 1 Address Name
Name E-Mail Address
Birthday E-Mail
Birthday
106
«interface» «interface»
Collection Map
«interface»
«interface» «interface» «interface» SortedMap
Set List Queue
Linked TreeSet
HashSet
107
Java Collections: What is it?
Implementations
Hash Resizable Balanced Linked
Table Array Tree List
Set HashSet TreeSet
Interfa
ces List ArrayList LinkedList
109
Three Basic Java Collections
List : Sequences
Ordering is implicit
it is legitimate to ask questions like “what is the first
object in the sequence?”
Add book as first book etc.
Sets: Unordered collection
Maps: Qualified associations
Each entry involves a pair of objects.
A map is also called as a dictionary.
it is legitimate to ask questions like “what value - if any
- is associated with the following key?” or
“does this map contain the following key?”.
For all types of Collections:
Can create an Iterator object to access each item110in
the collection once.
Which List to Use?
LinkedList:
Goodif the list changes size (grows or
shrinks) frequently
Good for accessing either end of the list,
but slower when accessing items in the
middle of the list
ArrayList:
Good if accessing elements by specific
position, but slow for adds and removes.
111
Vector class
In what ways different from
ArrayList?
Similar to an ArrayList, but
synchronized for multithreaded
programming.
Mainly for backward-compatibility
with old java.
Used also as base class for Stack
implementation. 112
Which Sets to Use?
HashSet:
Good efficiency in most cases
TreeSet:
Useful when an iterator will access
the elements of the set in a specific
order based on their value (e.g.
Strings would be kept in alphabetical
order.)
113
Which Map to Use?
HashMap:
TreeMap:
boolean isEmpty( );
}
Ordered Association
* {ordered} *
Tournament Player
1-to-many association:
Translate into a Vector
Qualified association:
Translate into a Hash table 119
Which sentences are true?
a) CheckingAccount implements BankAccount
b) CheckingAccount and SavingAccount are BankAccount
c) CheckingAccount and SavingAccount are associated
d) BankAccount is associated to CheckingAccount
e) SavingAccount can processCheck
120
f) CheckingAccount has a balance
Aggregation Relationship
Represents whole-part relationship
Represented by a diamond symbol at
the composite end.
Usually creates the components:
Butoften indistinguishable from plain
association.
Except,aggregate usually invokes the
same operations of all its components.
Usually owner of the components:
121
But can share with other classes
Aggregation Relationship
1
Document * Paragraph 1
* Line
1 1
Company
employs
* Person * memberOf
Club
122
Aggregation cont…
*
No circular inclusion relation.
123
Aggregation vs. Inheritance
Cont…
Inheritance:
Different object types with similar
features.
Necessary semantics for similarity of
behavior is in place.
Aggregation:
Containmentallows construction of
complex objects.
124
Aggregation vs. Inheritance
Aggregation Inheritance
Instances of distinct Instances of a single
classes class
“a-part-of” (APO) “a-kind-of” or “is-a”
(AKO)
Propagated only if Inheritance
specified
Aggregate + parts Superclass + subclass
25
125
Composition
A stronger form of aggregation
The whole is the sole owner of its part.
A component can belong to only one whole
Thelife time of the part is dependent
upon the whole.
The composite must manage the creation and
destruction of its parts.
1 Circle
Circle Point
3..* Point
Polygon 126
Composition Relationship
1
Order * Item
127
Composition: Alternate Notation
Car
4 1
Wheel Engine
2 1
Door Chassis
1 1
Axle Steering
128
Composition
• An object may be a part of ONLY one
composite at a time.
Whole is responsible for the disposition of its
parts. whole
Window
*
Frame part 129
Aggregation vs. Composition
Composition:
Composite and components have the same
life line.
Aggregation:
Lifelines are different.
Consider an order object:
Aggregation:If order items can be
changed or deleted after placing order.
130
Composition: Otherwise.
Composition versus Aggregation
1
* Composition
Order Item
1
* Aggregation
Order Item
131
Implementing Composition
public class Car{
private Wheel wheels[4];
1 4 Wheel
public Car (){ Car
wheels[0] = new Wheel();
wheels[1] = new Wheel();;
wheels[2] = new Wheel();;
wheels[3] = new Wheel();;
}
} 132
Representing Aggregation in Classes
An aggregation relationship is usually represented
as a data field in the aggregated class.
/* Methods */ /*Constructors*/
/** Constructors */
} /** Methods */ /** Methods */
} }
133
Inner Classes Translation
} 134
Implementing Aggregation: Ex 1
import java.util.ArrayList;
public class CarShop{
private ArrayList<SalesPerson> people = new
ArrayList<SalesPerson>();
private ArrayList<Car> cars = new
ArrayList<Car>();
public Dealership(String company, Manager
manager) {
this.company = company;
this.manager = manager;
}
1
* Car
Car Shop
* Salesman
135
Implementing Aggregation: Ex 2
Class Aggregator{
Public class sentence{
Char [] text; public static void main() {
} BufferedReader br=new
BufferedReader(new
Public class paragraph{
InputStreamReader(System.in));
private ArrayList <Sentence>
sentList=new Paragraph p= new Paragraph();
ArrayList<Sentence>(); do{
public addSentence(Sentence s){ String line=br.readLine();
sentList.add(s);
p.addSentence(line);
}
}
}
1 }
Pragraph * Sentence 136
}
How to identify
aggregation/composition?
Lifetime of part is bound within lifetime of
composite
There is a create-delete dependency
138
Dependency
Dependency relationship can arise due to a variety
of reasons:
Stereotypes are used to show the precise nature of
the dependency.
Type of Stereotype Description
dependency
Abstraction «abstraction» Relates two model elements, that
represent the same concept at
different levels of abstraction
Binding «bind» Connects template arguments to
template parameters to create
model elements from templates.
Realization «realize» Indicates that the client model
element is an implementation of the
supplier model element
Substitution «substitute» Indicates that the client model
139
element takes place of the supplier.
Dependency
Commonly Dependence may be caused by:
Local variable
Parameter
Return value
Example
Class A { Class B {
B Foo(B x) { …
B y = new B(); …
return y; …
}
140
} }
Dependence – Possible Implementations
class MyDependentClass{
void myFunction1(
MyClass
MyReferencedClass r ) {
att: int .. }
myFunction()
MyreferencedClass
dependence myFunction2( .. ) { .. }
arrow
void myFunction3( .. ){
MyReferencedClass MyReferencedClass m .. }
}
141
Association Vs. Aggregation
Is aggregation an association?
Is composition an aggregation?
142
Association Types
aggregation: "is part of" Car
1
Symbolized by a white diamond aggregation
1
composition: is made of Engine
Stronger version of
Book
aggregation composition
Object Object
Aggregation Composition
Object Association Association Association
1..* 1
n n
0..* 0..*
Faculty SalesOrder
(team- 1..5 1
teaching is
possible) 0..* 1..*
CourseTeaching SalesOrderLineItem
145
Multiplicity Quiz #1
Whole
Draw Class
diagram 3
1
5 2
Part1 PartN
•One Whole is associated with 5 Part1 •One Whole is associated with 2 PartN
•One Part1 is associated with 1 Whole •One PartN is associated with 3 Whole
P1
Object diagram W
P1
Pn
W P1 Pn W
P1 W Pn
P1
W
W 146
P1
Class Relation Hints
Composition
B is a permanent part of A
A contains B
A is a permanent collection of Bs
Subclass / Superclass
A is a kind of B
A is a specialization of B
A behaves like B
Association (Collaboration)
A delegates to B
A needs help from B
147
A and B are peers.
Class Diagram Inference Based on Text Analysis
(based on Dennis, 2002)
A common or improper noun implies a class e.g.
Book
A proper noun implies an object (instance of a
class): CSE Dept, OOSD, etsc.
An adjective implies an attribute e.g. price of book
A “doing” verb implies an operation
Can also imply a relationship e.g. student issues Book
A “having” verb implies an aggregation relationship
A predicate or descriptive verb phrase elaborates
an operation e.g. ISBN numbers are integers
An adverb implies an attribute of an operation e.g.
fast loading of image…
148
Identify Class Relations
Faculty & student
Hospital & doctor
Door & Car
Member & Organization
People & student
Department & Faculty
Employee & Faculty
Computer Peripheral & Printer
149
Account & Savings account
Identify Classes & Relations
A square is a polygon
Shyam is a student
Every student has a name
100 paisa is one rupee
Students live in hostels
Every student is a member of the library
A student can renew his borrowed books
The Department has many students 150
Identify Classes & Relations
A country has a capital city
A dining philosopher uses a fork
A file is an ordinary file or a directory file
Files contain records
A class can have several attributes
A relation can be association or
generalization
A polygon is composed of an ordered set of
points
A person uses a computer language on a
project 151
Exercise: Draw UML Diagrams
1..* 1..*
Editor publishes Journal Area
Addressed in
-editorName -journalName -areaName
-nationality 1 0..* 1 -areaDetails
-ISBN
-shelf
has
0..* Member
Operation 0..* 1 -userName
performs
-address
-date -birthDate
-operationType
-phone
-email
156
Elevator System
157
Identify Classes and Relations
Controller program for an elevator is to be developed.
Each elevator has a set of m buttons, one for each floor.
These illuminate when pressed and cause the elevator to visit
the corresponding floor.
The illumination is canceled when the elevator reaches the
corresponding floor.
Each floor, except the first floor and top floor has two
buttons:
One to request and up-elevator and one to request a down-
elevator.
These buttons illuminate when pressed. The illumination is
canceled when an elevator visits the floor. The door opens as
soon as it stops at a floor.
When an elevator has no requests, it remains at its
158
current floor with its doors closed.
Elevator Elevator_Controller control Door
control
Preliminary
only: Please *
Button
refine
yourself
Elevator_Button Floor_Button
159
Interface
An interface in UML is a named set of operations.
Interfaces are used to characterize the behaviour
of some classes.
Shown as a stereotyped class.
<<interface>>
List
Add( )
isEmpty( )
…
<<interface>> Cylinder
Shape
Draw
Move
Scale
Pyramid
Rotate
Cube
Realization relationship
161
Realizing an Interface
A class realizes an interface if it provides
implementations of all the operations.
Similar to the implements keyword in Java.
UML provides two equivalent ways of denoting this
relationship:
CircularLinkedList <<interface>>
List
CircularLinkedList
List
<<use>>
List 163
Collection List
<<interface>> <<interface>>
Stack
LinkedList 164
Interface Representations
Tube
Alternate
Representations Pyramid
Cube
Shape
Implementors
Tube
Service <<interface>>
description Shape
Pyramid
Draw
Move
Scale Cube
Rotate 165
Interface Diagram Example
Storable
Class A Class B
Runnable
<<interface>> <<interface>>
Runnable Storable
Class C Runnable
run() {} load() {}
save() {}
167
Packages
Model elements in a package are taken
to be related semantically (group).
Packages can be related to each other:
By dependencies or generalizations
credits
•Part may belong to several whole
Course Course
List
* 30..32
1
•Composition: Core Elective Course offering
{salary <=boss.salary}
Employee Employer
Salary reports to Salary
173
Constraints and Notes
Can be used to annotate:
Associations, attributes, operations,
classes, etc.
Constraints are expressed in OCL:
Semantic restrictions noted as Boolean
expressions.
Customer 1 Place *
Order
may be
{ total < $50 } cancelled
id: long { value > 0 }
Types of abstraction:
Data abstraction
Behaviour abstraction
176
Abstract Classes
- Rental fee()
VHS DVD
178
Abstract Class
cont…
Figure {abstract}
Figures
*
# position: Pos
+draw () {abstract}
Group Polygon
draw () draw ()
180
Abstract public class Figure {
abstract public void draw();
protected Pos position; Java
} Implementation
public class Group extends Figure {
private Vector <Figure> figures = new Vector
<Figure> ();
public void draw () {
}
}
public class Polygon extends Figure {
public void draw () { // draw polygon
code
181
}
What is Polymorphism?
Denotes poly (many) morphism
(forms).
Under different situations:
Same message to the same object can
result in different actions:
Two types:
Static
182
Dynamic
An Example of Static Binding
Class Circle{
private float x, y, radius;
private int fillType;
183
An Example of Static Binding
cont…
Assume a class named Circle has three
definitions for create operation
Without any parameter, default
Centre and radius as parameter
Centre, radius and fillType as parameter
Depending upon parameters, method will be
invoked
A A a; B b;
a=b; (OK)
B b=a; (not OK) 186
Liskov Substitution Principle
(Barbara Liskov, 1988)
If for an object o1 of type A there
is an object o2 of type B such that A
is a subtype of B:
Then it is possible to use o1 for o2.
A A a; B b;
a=b; (OK)
B b=a; (not OK)
187
Or in Plain English
Any subclass object should be
usable in place of its parent class
object.
Corollary:
All derived classes must honour the
contracts of their base classes
Ellipse Square
Cube
192
Genericity
Generic programming = programming with
classes and methods parameterized with
types.
Example: class stack of different types of
elements:
Integer stack
Character stack
Floating point stack
Define generic class stack only once:
193
Later instantiate as required
Genericity
T
Set
insert(T)
remove(T)
Refinement
EmployeeSet
194
Java Generics
A generic class is recompiled with different types as
needed.
The bad news:
Instead of: List words = new ArrayList();
Write: List<String> words = new ArrayList<String>();
The good news:
Replaces runtime type checks with compile-time checks
No casting; instead of String title = (String) words.get(i);
use: String title = words.get(i);
Some classes and interfaces that have been “genericized”
are: Vector, ArrayList, LinkedList, Hashtable,
HashMap, Stack, Queue, PriorityQueue, Dictionary,
Prasad cs884
TreeMap and TreeSet 195 195
import java.util.ArrayList;
.....
ArrayList class
(generic)
ArrayList<String> L = new ArrayList<String>(8);
L.add("Li");
L.add("Robinson");
L.set(0,"Good");
…
…
L L
Li Li
Good
Size=1 Size=2 Robinson
L
Size=0
Capacity Capacity
Capacity=8 =8 =8
196
How do you Define your Own Generic Class?
public class GenericClass<T> {
private T obj;
public void setObj(T t) {obj = t;}
public T getObj() {return obj;}
public void print() {
System.out.println(obj);
}
}
Main:
GenericClass<Integer> g = new GenericClass<Integer>();
g.setObj(5); // auto-boxing
int i = g.getObj(); // auto-unboxing
g.print(); 197
Type Wrapper
Why does Java distinguish between primitive
types and objects?
Should n’t everything be objects?
Java uses primitive types such as int, double or
float to hold the basic data types :
For the sake of performance.
However, there are situations when you will need
object representations.
For example, when operation involving objects is
required, you cannot use primitive types.
To handle these situations Java provides type
Wrappers which provide classes that encapsulate a198
primitive type within an object.
Auto Boxing and Unboxing
Autoboxing is a process by which primitive type
is automatically encapsulated(boxed) into its
equivalent type wrapper
Example:
public static void main(String[] args) {
Integer iob = 100; //Autoboxing of int
int i = iob; //unboxing of Integer
199
}
Advantages of Object-Oriented
Development
Code and design reuse
Increased productivity
Ease of testing (?) and maintenance
Better understandability
Elegant design:
Loosely coupled, highly cohesive objects:
Essential for solving large problems. 200
Experience Report
Initially incurs higher costs
203
Example
has 0..1
School Department
1 1..n 1..n
1..n 1..n
assignedTo
member
-chairperson
n 1..n 1..n 0..1
Student attends Course teaches Instructor
n n n 1..n
204
Qualified Association
Represent the following using UML
class diagram:
A library member can issue a book
Date issued and returned must be
kept track of
Member Book
Member
*
Book
1
IssueRecord
IssueReord
*
borrowDate: Date
issueDate:Date Returndate: Date
205
returnDate:Date
Association - Multiplicity
A cricket team has 11 players. One of them is the
captain.
A player can play only for one Team.
The captain leads the team members.
Captain
Team
Memb 1
er Player 0..1
Team
10
11 member of 1
Captain
1
Leads 206
Book
Solution Q.1
*
Part
*
Chapter
*
Section 207
Marking Guide
Four Classes are represented with rectangles.
[1]
Vehicle {abstract}
drive () {abstract}
209
Java Implementation
Abstract public class Person {
private ArrayList<Vehicle> drives = new
ArrayList<Vehicle>();
}
Abstract public class Vehicle{
private int color;
abstract public void drive ();
}
public class Scooter extends Vehicle{
public void drive () {}
}
….. 210
Quiz
Convert qualified association into normal
association…
StockExchange * 1 Company
tickerSymbol SX_ID
Lists
StockExchange
* * Company
Lists tickerSymbol
SX_ID
211
Unified Modelling
Language
12/30/2021 1
Object Modelling Using UML
UML is a modelling language.
Not a system design or
development methodology
OMT
UML
Booch’s
OOSE
Methodology
5
UML as A Standard
Adopted by Object Management
Group (OMG) in 1997.
OMG is an association of industries
Promotes consensus notations and
techniques
UML also being used outside software
development area:
Example car manufacturing 6
History of UML
UML 2.0
Industrialization
public
feedback UML
UML 0.9
0.9 && 0.91
0.91
Unification
Booch'93 OMT-2
Fragmentation 7
Other methods Booch'91 OMT-1 OOSE
Developments to UML
UML 2.0 2003
UML continues
Application
to develop: to embedded
systems
Refinements UML 1.X
Making it
applicable to new
contexts UML 1.0 1997
8
Why are UML Models Required?
Modelling is an abstraction mechanism:
Capture only important aspects and
ignores the rest.
Differentmodels result when different
aspects are ignored.
Aneffective mechanism to handle
complexity.
UML is a graphical modelling tool
Easy to understand and construct 9
Modeling a House
10
UML Diagrams
Nine diagrams in UML1.x :
Used to capture 5 different views of a
system.
Views:
Providedifferent perspectives of a
software system.
Diagrams can be refined to get the
actual implementation of a system. 11
UML Model Views
Views of a system:
User’s view
Structural view
Behavioral view
Implementation view
Environmental view 12
Diagrams and views in UML
Behavioural View
Structural View - Sequence Diagram
- Class Diagram - Collaboration Diagram
- Object Diagram - State-chart Diagram
- Activity Diagram
User’s View
-Use Case
Diagram
13
Diagrams in the UML 2.0 -- 13 Diagrams
14
UML 2.0 Diagrams
Class
Diagram
Component
Diagram
Structure Composite
Diagram Structure Diagram
Deployment
Diagram
Object
Diagram
Package
UML 2.0 Diagram
Diagram
Sequence
Use Case Diagram
Diagram
Behavior Communication
Activity Diagram
Diagram Diagram
Interaction
Interaction Overview
Diagram Diagram
State Machine Timing
Diagram Diagram
15
Structural Diagrams
Class Diagram
set of classes and their relationships.
Object Diagram
set of objects (class instances) and their
relationships
Component Diagram
logical groupings of elements and their
relationships
Deployment Diagram
set of computational resources (nodes) that host
each component. 16
Behavioral Diagrams
Use Case Diagram
high-level behaviors of the system, user goals,
external entities: actors
Sequence Diagram
focus on time ordering of messages
Collaboration Diagram
focus on structural organization of objects and
messages
State Chart Diagram
event driven state changes of system
Activity Diagram
flow of control between activities 17
Quotable Quotes on Using UML
“UML is a large and growing beast, but you
don’t need all of it in every problem you
solve…”
– Martin Fowler
“…when learning the UML, you need to be
aware that certain constructs and
notations are only helpful in detailed design
while others are useful in requirements
analysis …”
– Brian Henderson-Sellers 18
Are All Views Required for Developing
A Typical System?
NO
For a simple system:
Use case diagram, class diagram and one of
the interaction diagrams only.
State chart diagram:
when class has significant states.
When states are only one or two, state chart
model becomes trivial
Deployment diagram:
In case several hardware components used to
develop the system. 19
Key Diagrams in UML
12/30/2021 21
Use Case Model
Consists of a set of “use cases”
query-book
return-book
create-member
add-book, etc. 25
Representation of Use Cases
Represented in a use case diagram
A use case is represented by an ellipse
System boundary is represented by a
rectangle
Users are represented by Play Move
Play Move
Tic-tac-toe game
27
Use Case Modelling
(Lecture 6) 19-08-2015
28
Exercise1: Video Store Information System
Video Store Information System supports the
following business functions:
Recording information about videos the store owns
This database is searchable by staff and all customers
Rent/Return
Videos
«include» Customer
Staff
Search for
Videos
Maintain
Customers
«include»
Maintain
Videos
Manager Generate
Reports
30
Effective Use Case Modelling
Use cases should be named and organized
from the perspective of the actor.
"how".
An Example Use Case Diagram
Play Move
Tic-tac-toe game
Player
32
Relationships between Use Cases
and Actors
Actors may be connected to a use
case by association relation:
Indicating that the actor and the use
case communicate with one another.
update
grades
faculty 33
Another Example Use Case Diagram
Video Store
Information System
Rent
Videos
Clerk <<external system>>
Credit Authorization
. . . Service
34
Yet Another Use Case Example
Telephone Catalog
Check
Status Salesperson
Place
Order
Establish
credit
Supervisor
35
Why Develop A Use Case Diagram?
Serves as requirements specification
How are actor identification useful in
software development?
Identifies different categories of users:
Helps in implementing appropriate interfaces
for each category of users.
Post Condition:
The current amount of cash in the user account is the
amount before withdraw minus withdraw amount
A receipt was printed on the withdraw amount 38
ATM Money Withdraw Mainline Scenario
Actor Actions System Actions
1. Begins when a Customer arrives
at ATM
2. Customer inserts a Credit card 3. System verifies the customer ID
into ATM and status
5. Customer chooses “Withdraw” 4. System asks for an operation type
operation
7. Customer enters the cash 6. System asks for the withdraw
amount amount
8. System checks if withdraw amount
is legal
9. System dispenses the cash
10. System deduces the withdraw
amount from account
Bad: “Get the amount from the Actor gives the amount
user and give him the receipt.” System produce the money
2. Event-based
- Identify the external events that the system
must respond to.
- Relate the events to actors and use cases. 42
Factoring Use Cases
Two main reasons for factoring:
Complex use cases need to be factored
into simpler use cases
To represent common behavior across
different use cases
Three ways of factoring:
Generalization
Include
Extend 43
Generalization
The child use case inherits the
child
44
Generalization Example 1
Registration
Under-graduate Graduate
registration registration
45
Factoring Use Cases Using
Generalization
46
Factoring Use Cases Using Include
<<include>> Common
Base use case
use case
<<include>> <<include>>
<<include>> <<include>>
48
Example of Factoring Use Cases
Using Includes
<<include>>
<<include>>
Check Reservation
49
Factoring Use Cases Using
Extends
51
Factoring Use Cases Using
Extends
52
Extension Point
The base use case may include/extend
other use cases:
At certain points, called extension
points.
<<extend>>
Perform Sale Product is a gift
Gift wrap
After checkout Product
53
Use Case Relationships
Order
Supply
Product
Customer Arrange
Data Payment
<<include>>
<<include>>
<<include>>
Place Order
Cash Credit
Payment Payment
Sales Person
<<extend>>
Salesperson asks for
catalog
Request
Catalog
54
Exercise 2: Use Case Model for Course Management Software
At the beginning of each semester,
Each professor shall register the courses that he is going to
teach.
A student can select up to four-course offerings.
During registration a students can request a course catalogue
showing course offerings for the semester.
Information about each course such as professor, department
and prerequisites would be displayed.
The registration system sends information to the billing
system so the students can be billed for the semester.
For each semester, there is a period of time during
which dropping of courses is permitted.
Professors must be able to access the system to see
which students signed up for each of their course
55
offerings.
Exercise 2: Answer
Course Management Software
Register
offering
See
Course
Professor Show List
registration
<<Extend>>
<<External>>
Register
Billing System
course
Student
Drop
Course
Calendar
56
Hierarchical Organization of Use
Cases
use case 1 use case 3 External users
use case 2
Subsystems
use case 3. 2
Methods
use case 2
57
Too many use cases
at any level should
be avoided!
58
Use Case Packaging
Accounts
Print
Query balance
Balance sheet
Receive Make
grant payments
59
Use-Case Model using Packaging
60
Use Cases of Order Entry Subsystem
61
Use Case Description
Name
Actors
Trigger
Preconditions
Post conditions
Success Scenario
Alistair Cockburn
“Writing
Effective Use
Cases”
Alternatives flows
62
Triggers
What starts a use-case?
Examples:
Customer initiates a claim report by
clicking a button on a web page
Customer inserts ATM card
System clock is 10:00
etc. 63
Preconditions
What the system needs to be true
before running the use-case.
Examples:
The use has logged on
Requested Book is issued out
User account has been created
The membership has expired
64
Post-Conditions
A post-condition is the outcome of a use-case.
Examples:
Money is transferred to the user account
User is logged in
The file is saved to the hard-disk
Minimal guarantee:
The things that a system can promise, holding even
when the use case execution ended in failure
Example: Money is not transferred unless
authorization is granted by the user
Success guarantee:
What happens after a successful conclusion of the use-
case.
65
Example: Transaction logged; Money is transferred
Success Scenario
The success scenario is the main story-line of
the use-case:
Under the assumption that everything is okay, no
errors or problems occur
Typically, it is composed of a sequence of action
steps Interaction
step
Online HR System
Recruit
Employee
Manager
Update
Employee
Profile
Update
Benefits
Employee Healthcare
Plan System
Access Pay
Records
Access
Travel
System
Insurance
Plan System
70
Online HR System: Use Case
Relationships
Update
Update Dental Plan Update
Medical Plan Insurance
Plan
<<include>>
<<include>> <<include>>
Update Benefits
Extension points Extension point
benefit options : name and location
After required enrollments
Employee
<<extend>>
Employee requests stock
<<extend>> purchase options
Employee requests
reimbursement options
Select stock
option
Select
Reimbursement
Extension
for health care condition
71
Online HR System: Update Benefits Use Case
Actors : employee, employee account db, healthcare plan system,
insurance plan system
Preconditions:
Alternative courses
If health plan is not available in the employee’s area the
employee is informed and asked to select another plan... 72
Style Notes (Ambler, 2005)
Use case name should begin with a verb.
While use cases do not explicitly imply timing:
Order use cases from top to bottom to imply timing -- it
improves readability.
74
Quiz: Home Assignment System - Use Case Model
HAS will be used by the instructor to:
Distribute the homework assignments,
Review the students’ solutions,
Distribute suggested solution,
Assign grade to each assignment.
Students can:
Download assignments
Submit assignment solutions
System:
Automatically reminds the students a day before an
75
assignment is due.
Quiz: Solution 1 (Inferior)
Remind
Student
Submit
<<Extends>>
Post Solutions Assignment
Student
Distribute Get
Grade Solution
Instructor
Get Grade
76
Quiz: Alternate (Better) Solution
Distribute
Assignments
Post Solutions
Student
Distribute
Grade
Instructor
Submit
Assignment
Remind
Student
Calendar
77
Class Diagram: Already Discussed!!
Describes static structure of a
system
Main constituents are classes and
their relationships:
Generalization
Aggregation
Association
Mritunjay LibraryMember
LibraryMember
B10028
C-108, Laksmikant Hall Mritunjay
1119 B10028
Mrituj@cse C-108, Laksmikant Hall
25-02-04 1119
25-03-06 Mrituj@cse
NIL 25-02-04
25-03-06
IssueBook( ); NIL
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
Return
Book member: book:Book :Book
LibraryMember Copy
Use ok = canBorrow()
Case borrow(book)
Borrow
Book [ok] borrow(member)
setTaken(member)
Search
Book
87
87
Sequence Diagram
Shows interaction among objects as a two-
dimensional chart
message
Activation
[ok] borrow(member) box
setTaken(member)
condition
msg1( )
93
Representing an object
Class name, optionally preceded by object
name and colon:
write object's name if it clarifies the diagram
object's "life line" represented by dashed
vertical line Anonymous object Object of
Object
unknown Class
Smith :
:Patient Smith
Patient
94
Name syntax: <object name>:<class name>
Messages between objects
Message (method call) indicated by a horizontal
arrow to other object:
:Controller :Controller
95
asynchronous
return
95
Message Arrows for Communication
Message arrows represent communications
between two objects in a sequence diagram
Synchronous message :
Sending object suspends action and waits for the
response to the message
(filled head)
Asynchronous message:
Sending object continues with its operations without
waiting for the response
(open head)
:ActionListener inv:Inventory
addActionListener(self:ActionListener)
Time
…continue operation…
The eventual
response is
actionPerformed(e: ActionEvent) called a callback
98
Return Values
Optionally indicated using a dashed
arrow:
Label indicates the return value.
Don’t
need when it is obvious what is being
returned, e.g. getTotal()
Model a return value only when you
need to refer to it elsewhere:
Example:A parameter passed to another
message. 99 99
Summary of Kinds of Arrows
Procedure call or other kind of nested
flow of control
(The sender losses control until the
receiver finishes handling the message)
Return
(Unblocks a synchronous send) 100
Synchronous Messages
Flow of control, typically implemented as a
method call.
The routine that handles the message is
completed before the caller resumes execution.
:A :B
doYouUnderstand()
return
Caller (optional)
Blocked yes
101 101
Lifetime of objects
creation: arrow with
'new' or create written
above it
Notice that an object
created, appears at point
of call.
deletion: an X at bottom
of object's lifeline
Java doesn't explicitly
delete objects; they fall
out of scope and are
garbage-collected 102
102
Method calls
Activation: thick box over object's life line; drawn
when object's method is on the stack
Either that object is running its code, or it is on
the stack waiting for another object's method to
finish
Nest to indicate recursion
Activation
:Controller
Nesting
Activation 103
Elements of a Sequence Diagram
: Customer : Order : Pay ment : Produc t : Supplier
object
plac e an order
process
Activation lifetime
validate
if ( payment ok )
if ( not i n stock )
deli ver
back order
get address
mail to address
message
104
Example
Cont…
: Customer : Order : Pay ment : Produc t : Supplier
plac e an order
process
validate
Sequence of message sending
if ( payment ok )
if ( not in stock )
deliver
back order
get address
mail to address
105
An Example of A Sequence Diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary Renewal Member
Register
Controller
confirm
confirm
updateMemberBorrowing
106
Sequence Diagram for the renew book use case
Method Population in Classes
Methods of a class are determined
from the interaction diagrams…
:Registration :Registration
form manager
RegistrationManager
add course
(joe, math 01)
addCourse(Student,Course)
107
Example Sequence Diagram:
Borrow Book Use Case
borrow(book)
ok = canBorrow()
[ok] borrow(member)
setTaken(member)
108
Object Creation
An object may create another object
via a <<create>> message.
:A
<<create>>
:B
109
Object Destruction
An object may destroy another object via a
<<destroy>> message.
An object may also destroy itself.
But, how do you destroy an object in Java?
Avoid modeling object destruction unless memory
management is critical.
:A :B
<<destroy>>
110
Control Information
Iteration example UML 1.x:
:CompoundShape :Shape
draw()
*draw()
111
Exercise 0
A user can use a travel portal to plan a
travel
When the user presses the plan button, a
travel agent applet appears in his window
Once the user enters the source and
destination,
The travel agent applet computes the route and
displays the itinerary.
The travel agent widget gets destroyed and
112
disappears
Exercise 0: Solution
:client
plan
<<create>> :travelAgent
setItinerary
calculateRoute
<<destroy>>
113 113
Exercise 1
A clerk in the RTO office uses a traffic violation
application to find the details of any traffic
violation by entering the violation id.
The clerk first presses the view button in the
dialog box of the application.
This request is conveyed to the controller object
The controller object asks for the violation id
id=getID()
getViolation(id)
<<create>>
v:Traffic
May be a Violation
pseudo-
method
v DB is
display(v) queried and
the result is
returned as
an object
115 115
Exercise 2: Print Server
A print server is an active object
Active :Printer
object :PrintServer :Queue Proxy
Client
Application
print(doc,client) enqueue(job)
loop queue-not-empty()
job=dequeue()
[job]print(job.doc)
status
[job] done(status)
117 117
Guards in Communication Diagrams
message
118
Sequence Diagram: Frames
A frame consists
of:
1) Diagram identifier order process
2) Participants in a
rectangle depicting :client :order :inventory
the participating
objects: create
Locate item
A dotted line that
extends for the time
period of the
interaction
3) Messages to
communicate among
119
the participants
Example Sequence Diagram
order
:StoreFront :Cart :Inventory
loop
AddItem
ReserveItem
PlaceItemInOrder
120
Interaction Frame
op (operator):
applied to the enclosed interaction(s)
(some operators require arguments, such as diagrams names,
parameters, constants and guards)
[guard]:
a boolean expression
op [:arguments] [ [guard] ] the interaction is executed according
to the guard’s value
diagram name:
needed if we want to refer to a diagram defined elsewhere
121
Depicting a Fragment Graphically
sd sample
create
operator op1
Interaction
Fragment
Operation
Name: Interaction
(e.g. loop) Fragment
Operand
Locate item
122
Interaction Frame Example
op [guard_1]
interaction_1
…
[guard_n]
interaction_n
126
Sequence Diagram for Telephone Order
Scenario
127
Alternative Fragment
sd sample
Interaction
Interaction client order inventory Fragment
Fragment
Operation
Name:
(Alternative)
Alt [new_cust=yes]
cr_custinfo()
Cr_order( )
Interaction
Fragment
128
Operands
Loop Fragment
sd
sample order inventory
n_it = check_items()
checking
Interaction create
Fragment iterator for
more
Operation more = has_item items
Name: (n_it)
Loop (min,max)
Loop [more]
Process_item()
The guard
expression of
[ more] more =
has_item(n_it)
129
Interaction Frames for Indicating selection and loops
Frame: box around part of a sequence diagram to
indicate selection or loop
if -> (opt) [condition]
if/else -> (alt) [condition], separated by horiz. dashed line
loop -> (loop) [condition or items to loop over]
opt [balance
<> 0] alt [balance
< 100.00]
[balance
>= 100.00]
loop [balance
< 0]
130
130
Linking Sequence Diagrams
If one sequence diagram is too large or refers to
another diagram, indicate it with either:
an unfinished arrow and comment
a "ref" frame that names the other diagram
Approved?
131
Logic in sequence diagrams: Which notation do you prefer?
:Foo :Bar
xx
opt [color = red] calculate
yy
:Foo :Bar
xx
[color = red] calculate
yy 132
Nesting Frames
:Foo :Bar
xx
opt
[colour : red]
Loop(n)
calculate
133
:Employee :EmployeeDB
Emp=getEmployee(empId)
makeSquare
new
:Square
:TreeMap :TreeNode
clear
destroy
138
139
Sequence Diagram : Enroll Student
u:URSDatabase stu:Student
procCmd(cmd)
parseCommand(cmd)
new a:AssgSubCmd
execute()
getStudent(id)
return stu
getSubject(subId)
[if stu != NULL and sub !=
return sub NULL]
addSubject(sub)
140
Exercise 6
class AssgSubCmd{ Write
Java Code
private URSDatabase u;
public execute(){
Student stu = u.getStudent(id);
Subject sub = u.getSubject(subId);
if (stu != null && sub != null){
stu.addSubject(sub);
}
}
} 141
Exercise 7: Java Code for Sequence Diagram
alt
ref
[ValidUser]
placeOrder(Order: iOrderNo)
return()
return()
142
public void newTransaction(){
// behavior is an Interaction
if (ValidUser) // Alt combined fragment
{
placeOrder(101); //Interaction Occurrence
}
else
{
return;
}
}
143
Exercise 8: Sequence Diagram
“Compute Price” use case is invoked in
the context of a specific order to
calculate the price of the order.
getProduct
getPricingDetails
getDiscountInfo
calculateDiscounts
146
Exercise 9: Consider the following Java code.
Draw a sequence diagram to represent the
message exchanges that occur among objects
when the printGameMoney() method of the
Game class is invoked.
class Ticket {
int gameID;
double price;
int seatnumber;
public int getPriceOfTick();
}
Class Game{
private List <Ticket> tickets=new Arraylist<Ticket>();
public static int printGameMoney(){
double total = 0;
for (final Ticket ticket : tickets) {
final double tickMoney = ticket.getPriceOfTick();
total = total + tickMoney;
}
} 147
}
Exercise 9: Solution
Ex.9
Print
Game
Money
Loop For all
Tckets
Get
Ticket
Price
148
Exercise 10: Draw a sequence diagram to
represent the following interactions between a
video store clerk and objects in a video rental
system. The scenario is name is rent video:
Clerk creates new a Rental object named
aRental.The message includes arguments for
memberID and videoID.
aRental sends addMemberToRental message to
Member object based on memberID, named
aMember, which returns member details.
aRental sends rentVideo message to a Video
object based on the videoID, named aVideo,
which returns video details.
149
aRental returns all rental details to the actor.
Video
Clerk aMember aVideo
aRental
create(memberID,videoID)
addMembertoRental()
Member details
rentVideo()
Video details
Rentaldetails
150
Exercise 11: Change Flight Itinerary
Actors: traveler, client account db, airline
reservation system
Basic course:
Traveler selects ‘change flight itinerary’ option
System retrieves traveler’s account and flight itinerary from
client account database
System asks traveler to select itinerary segment she wants to
change; traveler selects itinerary segment.
System asks traveler for new departure and destination
information; traveler provides information.
If flights are available then …
…
System displays transaction summary.
Alternative course: 151
If no flights are available then…
Example Answer: Change Flight Itinerary
get itinerary
present itinerary
select segment
update information
available flight
:
:
152
Sequence diagram exercise 12
Use Case: Add Calendar Appointment: Scenario
begins when the user chooses to add a new
appointment in the UI.
The UI notices which part of the calendar is active
and pops up an Add Appointment window for that date
and time.
The user enters the necessary information about
the appointment's name, location, start and end
times.
The Appointment window will prevent the user from
entering an appointment that has invalid information,
such as an empty name or negative duration.
The calendar records the new appointment in the 153
user's list of appointments. 153
Sequence diagram exercise 12
Use Case: Add Calendar Appointment:
Alternate scenario: If the user has an appointment at that
time, the user is shown a warning message and asked to
choose an available time or replace the previous
appointment. If the user enters an appointment with the
same name and duration as an existing group meeting, the
calendar asks the user whether he/she intended to join
that group meeting instead. If so, the user is added to
that group meeting's list of participants.
154
154
Activity Diagrams
Lecture 9
155
Collaboration Diagram
Known as Communication Diagram in UML 2
attach(s1)
attach(s2) Procedure call, RMI, JDBC, …
Observer
Time notify() design
pattern
update()
{update < 1 minutes}
getState()
update()
getState()
3 : notify() 4 : update()
s1 :StockQuoteSubscriber
1 : attach(s1)
6 : getState()
p : StockQuotePublisher 5 : update()
2 : attach(s2) s2 :StockQuoteSubscriber
157 157
7 : getState()
Another Example Collaboration Diagram
6: * find
:Library
Book :Book
[reserved] Register
9: update
8: apology 5: book 10:
Selected confirm
4: selectBooks
2: findMemberBorrowing
12: confirm
:Library
Member
updateMemberBorrowing
a:A
m1
create
:B
flag=doA(this)
create
doB(c) c:C
159
Quiz: Ans
public class B {
…
int doA(A a) {
int flag;
C c = new C();
a.doB(c); …
return flag; }
}
160
Activity Diagram
Not present in earlier modelling techniques:
Possibly based on event diagram of Odell [1992]
Send
Invoice Make Accept
Invoice Payment Payment
163
Activity Diagram Elements
Initial node
Activity final node
Action
Flow/edge
Fork
Join
Decision
Merge
Synch 164
Activities, Actions, Events
Activities are operations that take time and
can be interrupted:
Accessing a web page.
Writing to a disk.
Often modeled as nested states.
Actions are of very short duration and cannot
be interrupted:
Beep.
Display a menu.
Set a flag.
Events cause changes in state:
State transitions can trigger actions.
165
Transitions are essentially instantaneous.
Actions
The fundamental unit for execution
or behavior.
Represents some transformations or
processing in the modeled system
Examples: creating objects, setting
attribute values, linking objects together,
invoking user-defined behaviour, etc.
Receive
order Description of
the action
166
behaviour
Basic Elements—Action
A rounded rectangle represents an
action.
Example: Customer calls ticket
office
Customer Calls
Ticket Office
167
Activity Diagram (continued)
Transitions in an activity diagram do
not have labels:
They indicate the completion of an
action
Initial state
Final state
169
Decision point and merge ( ):
Inherited from state machines.
Get
Authorization
170
Decision
• A diamond with one flow entering and
several leaving.
[Drink contains
alcohol]
[Customer Is
less than 21
Years Old]
Customer
Orders Drink
[else]
[Customer Is
At least 21
Years Old] Get Drink For
Customer
171
Activity Diagram Nodes
Three type of nodes:
Receive
Action nodes: executable activity order
First Action To
DO
173
Basic Elements—Final node
The filled circle with a border as
the ending point.
An activity diagram can have zero
or more activity final nodes
First Action
To DO
174
Fork
Denotes the beginning of parallel
actions.
Verify Order
Products Are In
Stock
Receive
Order
Verify Customer
Has Available
Credit
175
Join
Models Synch with several flows entering and
one leaving.
All incoming flows must reach it before
processing may continue.
This denotes the end of parallel processing.
Verify Order
Products Are In
Stock
Accept Order
Verify Customer
Has Available
Credit
176
Customer Sales Stockroom
Request
service
Take
Order
Pay
Fill Order
Deliver
Collect order
order
:Order
[delivered]
Collect Deliver
order order
179
Signals
An Activity diagram can show response
to signals.
A signal indicates that the activity
receives an event from an outside process.
The activity listens those signals, and the
diagram defines how the activity reacts.
Report
Receive Cancel Meter
Cancel Order
Request Reading
At end of
month
182
Activity Diagram vs Flow Chart
Can represent parallel activity and
synchronization aspects
Swim lanes can be used:
To group activities based on who is
performing them
Initialize activity
Add student
fork/spawn
Synchronization
[else]
[ count < 10 ]
guard
check
student
records
receive
fees
allot create
hostel hospital
record
register
receive
in
fees
course
conduct
allot medical
room examination
issue
identity card 185
Activity Diagram: Example 3
Finance Order Stock
Processing Manager
Receive
Order Receive
Supply
Assign to Assign
[succeeded] Order Goods to
Order
[need to reorder]
Reorder
Item
Request
Return
Get Return
Number
Ship Item
Receive
Item
Item
[returned]
Restock
Item
Credit Item
Account [available]
187
Activity Diagram Exercise: Receive Order
When an order is received, each line item is
checked on the order to see if goods is in stock.
If in stock, assign the goods to the order.
If this assignment reduces stock below reorder level,
Reorder the goods.
While doing this, it is checked to see if the
payment is OK.
If the payment is OK and the goods in stock, dispatch
the order.
If the payment is OK but don’t have the goods, leave
the order waiting.
If the payment isn’t OK, cancel the order. 188
Activity
Diagram for
Receive Receiving
order
* for each line
Order
item on order
Check line
Authorise item
Payment
[failed] [in stock]
[succeeded] Assign
Cancel to Order
Order
[need to Reorder
reorder] item
[stock assigned
to all line items
and payment
authorised]
Dispatch
Order
189
Activity Diagram Exercise: Receive Supply
When a supply delivery comes in:
Outstanding orders are examined to
decide which ones can be fulfilled from
this incoming supply.
Then assign each o to its appropriate order.
for
receiving
Choose outstanding
Supply order items
* for each chosen
order item
Assign goods
to order
[all outstanding
order items
filled]
Add remainder
Dispatch
to stock
Order 191
Combined
Receive
Activity
order Diagram Receive
* for each line Supply
item on order
Choose
Check line outstanding
Authorise item
Payment
order items
[failed] [in stock] * for each chosen order item
[succeeded] Assign
Assign goods
Cancel to Order
to order
Order
[need to Reorder
reorder] item
[stock assigned
to all line items [all
and payment outstanding
authorised] order items
Dispatch filled]
Order Add remainder
to stock192
Order Stock
Finance
Processing Manager
Receive
order Receive
* for each line Supply
item on order
Choose
Check line outstanding
Authorise item
Payment
order items
[failed] [in stock] * for each chosen order item
[succeeded] Assign
Assign goods
Cancel to Order
to order
Order
[need to Reorder
reorder] item
[stock assigned
to all line items [all
and payment outstanding
authorised] order items
Dispatch filled]
Order Add remainder
With Swim lanes to stock193
A time signal
Receive Video
Order 30 days since sent last invoice,
and no payment received
Fill Order Send Invoice Resend Invoice What does the Rake
symbol mean?
Deliver
Order
Receive Payment
Accept a signal
Cancel
request
Close Order
Cancel Order
Deliver Order
Overnight
Regular delivery Receive
delivery
order
Fill order Send invoice
Deliver
denoted by action order
Receive
payment
with a “rake”
symbol
Close
order Subactivity has Close
order
Overnight Ordinary
delivery
delivery Receive
payment
Quiz 1: Close
order
Answer 198
State Machine
Diagrams
Lecture 10
12/30/2021 199
Krishna air travels (KAT) allows its registered customers to book
cars for travel to outstation locations or for drops at the local
Railway station. Before any one can book a car, he/she is required to
register once with KAT by providing name, residential address, phone
number, and identity proof. KAT entertains registration requests
from only the students and faculty members of IIT and rejects
requests received from any other person. Once a request from a
registered student or faculty is received by the KAT reception, the
request is sent to the accounts department who prepare a duty slip
(indicates driver name, Vehicle number, customer name and address,
and the date, time, and other specifics of the travel) and hand it out
to the driver. Whenever, outstation travel is involved, in addition to
duty slip generation, the accounts Department also sends the vehicle
to the maintenance department to make it journey worthy and to fill
up diesel. After the journey is performed, the driver takes the
signature of the customer on the duty slip and hands it over to the
accounts department. The accounts department prepares the bill
that the customer can download online. After the customer pays the
bill online, the records of journey are archived by
the accounts department. Quiz 2 200
1. Develop use case diagram. No text
description is necessary. [8]
State-dependent (modal):
Type of objects that react differently to
events depending on its state or mode.
206
time
Why Create State Model?
Tackle complexity
Document:
For review, explaining to others,
etc.
ON
OFF
208
Basic State Machine Diagram
Graphical representation of automata
behavior…
on
Lamp On
on
off
off
Lamp Off
209
Outputs and Actions
As the automaton changes state, it
generates outputs.
Alternate representations.
on on
Lamp Lamp On
On display(”on”)
on/display(”on”) on
off off
off off
Lamp Lamp
Off Off
C ollision
move stop
state transition
state
startAutopilot( normal )
Manual Automatic
Call event
Change event
when( 11:49PM )
Time event
Idle A ctive
after( 2 seconds ) 213
Activities, Actions, Events
Activities are operations that take time and can
be interrupted:
Accessing a web page.
Writing to a disk.
Can often be modeled as nested state diagrams.
Actions are of very short duration and cannot
be interrupted:
Beep.
Display a menu.
Set a flag.
Events cause changes in state:
State transitions can trigger actions.
214
Transitions are essentially instantaneous.
Exercise 0: Draw State Machine Diagram
of a Keyboard?
•Press any key: lower case ASCII code is sent
to computer…
•Can press the caps lock key: after which upper
case ASCII code will be sent on a key press…
Any key/
send-lower-
Case-code Caps Lock
Default
CapsLoc
Caps Unlock ked
AnyKey/
Send-upper-
215
Case-code
Exercise 1: State Machine Diagram of a
Library Book
•A library book to start with, is present in a shelf…
•When borrowed out, it is not on shelf…
initial state
state
On shelf
12/30/2021 217
Exercise 2: Construct State Model
A car is in initial mode when ignition is off:
it starts in an initial mode when ignition is keyed ON.
The car accelerates when the acceleration pedal is
pressed. Cruise Controller
While accelerating, the car goes into a cruise
mode, when cruise switch is set to ON.
Cruise mode is turned off either when brake is
applied or the cruise switch is turned off
From the cruise off state, cruise mode can be
resumed by setting cruise switch to ON.
When ignition is turned off the car goes to idle218
mode.
Cruise Controller
Acccel Engine
Off
Accelerating
Cruising Break
off Pressed
Cancel
Resume
Cruise 219
Exercise 3
How do you model a keyboard?
220
Solution
keyStroke++/
Transmit code
KeyStroke>100,000
Default
Broken
221
Exercise 4: Draw State Machine: GUI
Accepts only Balanced Parentheses
(
OK Wait
start
end )
* *
( ( (
( do count++
( do count=1
start OK Wait
) if count==1
) if count>1
do count=0
do count--
ctr : Integer
Lamp On
on/ctr = ctr + 1
off
Lamp Off
225
A Bit of Theory
An extended (Mealy) state machine is
defined by:
a set of input signals (input alphabet)
a set of output signals (output alphabet)
a set of states
a set of transitions
triggering signals
actions
a set of extended state variables
an initial state designation
226
a set of final states (if terminating automaton)
State Chart Diagram
FSMs suffer from a few severe
shortcomings:
Stationary Stationary
On
FSM:
State explosion
Lackof support for representing
concurrency
of documentation
of objects
…
Why not state diagrams?
superstates
substates
231
substates
Superstates and Substates
name of superstate substates terminal state
Dialing
LiftReceiver LiftReceiver
Digit(n)
entry/ start dial tone TheNumber: int
exit/ stop dial tone entry/ AddDigit
self-transition
Digit(n)
enclosing superstate
actions performed
A transition is drawn
with a labeled arrow,
event causing the
transaction
AnEvent [guard] / SomeAction
guard condition
Action to perform 234
Syntax of UML State machine
• State: A condition that holds during the life of
an object or an interaction.
Simple State: rectangle with rounded corners
do 235
Basic UML State chart Diagram
“top” state
State
Initial
pseudostate top
Trigger
Ready
Transition
stop /ctr := 0
Done
Final
Action
state
stop
236
Object Behavior in State Machines
Direct mapping:
on
Initialize
Object Lamp
On
Wait for
Event on/display(”on”)
Handle off
Event
off
Lamp
Off
Terminate
Object
stop
237
“Do” Activities
The thread executes until:
Unhappy
239
Predefined Action Labels
“entry/”
Identifies an action to be performed upon entry to the
state
“exit/”
Identifies an action to be 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
“include/”
Is used to identify a submachine invocation. The action
expression contains the name of the submachine that
240
is to be invoked.
Eliminating Duplicated Transitions
Duplicate transitions
usually exist when some
transition can happen
from every state:
Quit
“error”
“quit”
“abort”
LampOff
flash/ LampFlashing
entry/lamp.off()
FlashOn
off/ entry/lamp.on()
1sec/
1sec/
on/ on/
FlashOff
LampOn
on/
entry/lamp.off()
entry/lamp.on()
242
Group Transitions
Higher-level transitions
Default transition to
the initial pseudostate
1sec/
1sec/
on/
FlashOff
LampOn
on/
entry/lamp.off()
entry/lamp.on()
Group transition
243
Completion Transitions
Triggered by a completion event:
CommitDone
Phase2
244
Triggering Rules
Two or more transitions may have the same
event trigger:
Innermost transition takes precedence
Event is discarded whether or not it triggers a
transition
LampFlashing
FlashOn
on/
off/
on/
FlashOff
245
Simple Diagram for A Heart Monitor Application
Start Up
Problem
Switch Detected
ON
Switch
OFF
Startup
Off Complete Alarm
Switch Problem
OFF Detected
Operational
246
The Heart Monitor Revisited
Start Up
Transition to sub-state
Transition from
Super state
Switch
ON
Startup Problem
Off Complete Detected Alarm
Switch
OFF
Operational
247
Full Diagram for Heart Monitor Applications
The number of
states and
transitions StartUp
have grown Battery
quickly
Start Up Mains
Alarm Battery
Off etc
Alarm Mains
Operational
Battery
Operational
mains 248
Introducing Hierarchy
f
g h i j
A B C D E
k k k k
m
Z
super-state S
f
A g B h C i D j E
k
m
Z sub-states
249
Dialling
Composite
Start
entry/start dial tone
State:
exit/stop dial tone OR state
digit(n)
Encode
250
Composite States
Composite states can have:
– concurrent substates -and- relationship
• each substate separated from others by dotted line
– disjoint substates -or- relationship
• transitions between substates
Example of concurrent substates
Overhead Projector
On Desk Light Off
In a chess game:
Black and white sides take turn to
play.
black white
moves moves
Black’s
turn
253
Handling Interrupted States
Sometimes it is necessary to interrupt a
complicated procedure:
And then resume where you stopped
Consider installing a program on your
computer
“Out of memory: please delete some files and
hit continue”
In many situations in which a normal course
of events is interrupted and then resumed
How can this be handled in a nested state
254
diagram?
History
Return to a previously visited hierarchical
state.
Diagnosing
suspend/
Diagnostic1 Diagnostic2
Step11 Step21
255
Orthogonality
Multiple simultaneous perspectives on the
same entity.
age financialStatus
Child
Poor
Adult
Rich
Retiree
256
Orthogonal Regions
Combine multiple simultaneous descriptions
age financialStatus
Child
Poor
Adult
age financialStatus
Child Rich
Retiree
Poor
Adult
Retiree Rich
257
Orthogonal Regions - Semantics
All mutually orthogonal regions detect the
same events and respond to them
“simultaneously”
Usually reduces to interleaving of some kind.
legalStatus financialStatus
LawAbiding Poor
robBank/ robBank/
Outlaw Rich
258
Interactions Between Regions
Typically through shared variables or
awareness of other regions’ state
changes. sane : Boolean
flying : Boolean
Catch22
sanityStatus flightStatus
Crazy Flying
entry/sane := false; entry/flying := true;
(flying)/ (sane)/
request
Grounding/ (~sane)/
Sane Grounded
entry/sane := true; entry/flying := false;
259
Common Misuse of Orthogonality
Using regions to model independent objects
Person1 Person2
Person1 Person2
Child Child
Adult Adult
Retiree Retiree
260
Full Diagram for Heart Monitor Applications
Convert to
The number of
states and
transitions StartUp OR-State…
have grown Battery
quickly
Start Up Mains
Alarm Battery
Off etc
Alarm Mains
Operational
Why does the Battery
diagram grow
fast?
Operational
mains 261
Heart Monitor as Concurrent State Machine
Monitoring Subsystem
Running
Switch on
Startup
Problem
detected
Off Startup Alarm
Switch off Complete
Power Subsystem
Mains on
Battery Mains
Mains off
262
Another Example of A State Chart
Diagram
order received
Unprocessed
Order
[reject] checked [accept] checked
Rejected Accepted
Order Order
[some items available]
[some items not processed / deliver
available] processed
[all items
Pending available] Fulfilled
Order newsupply Order
arrive at
Moving floor Idle
Down
down floor
time-out 266
Exercise 3
To withdraw money:
pass/ Lock
Unlocked
coin/ Thank you
270
State Model power
OFF
powerOFF
coin/return
powerON
coin Unlock
Locked ed
cardSwipe pass
jump multiple
Alarm pass||jump
Entry/
display
271
Translate State Machine to Code
Complicacies:
272
How to Encode an FSM?
State table
Patterns
273
3 Principal Ways
Doubly nested switch in loop:
Scalar variable stores state
Used as switch discriminator for first level
switch
Event type is the descriptor in second switch
Hard to handle concurrent states, composite
state, history, etc.
State table
Patterns:
States are represented by classes
274
Transitions as methods in classes
Key Idea of First Approach
The trick is to make the “state” a variable:
While(TRUE){
switch (state){
Case state1: switch(event){
case event1: state=state2; etc…; break;
case event2:…
default:
}
Case state2:switch(event){…
…. }
275
}
State Table Approach
From the state machine, we can set up a state
transition table with a column for the actions
associated with each transition
e1 BTN_off none
BTN_off
e2 BTN_on set red LED flashing
e1 BTN_on none
BTN_on
e2 BTN_off reset red LED flashing
276
Turnstile: State Model power
OFF
powerOFF
coin/return
powerON
coin Unlock
Locked ed
cardSwipe pass
jump multiple
Alarm pass||jump
Entry/
display
277
enum State {Locked, Unlocked, Alarm, PowerOFF};
enum Event {Pass, Coin, multiplePass, jump, cardSwipe};
static State s = Locked;
void Transition(Event e){
switch(s){
case Locked:
switch(e){
case Coin:
s = Unlocked;
Unlock();
break;
Code case Jump:
s=Alarm;
Alarm();
break;
}
cont…
278
break;
case Unlocked:
switch(e){
case Coin: returnCoin();
break;
case Pass: s = Locked;
Lock();
break;
case jump:
case multiplePass: s=Alarm;
Alarm();
break;}
break;
case Alarm: …. … ….
279
Ex. 5: Course Registration Software
When the software starts, it initializes all
courses.
If a student registers, and the course is
open, student is registered and count
incremented.
If a course is cancelled the students are
notified.
If registered students are 10, the course is
closed, and it is allocated a room and time
280
slot.
State Transition Diagram
Add student[ count < 10 ]
Add Student
Initialization [count = 0]
Open
do: Initialize course
entry: Register student
exit: Increment count
Cancel
Cancel [ count = 10 ]
Canceled
do: Notify registered students
Closed
Cancel
do: Finalize course
281
Exercise 6
A digital watch has 2 switches M and A
The watch is in display mode by default
Pressing A is ignored
Pressing M once takes to Hour mode:
Pressing A advances hour
Pressing M once more takes to Min mode
Pressing A advances min
Pressing M once more:
Takes to display mode 282
Model Answer
A
Display A
Digital
M SetHours M
A A entry/ SetMinutes
display=digital
Analog
Code?
283
Public class State{ Public void M(){
public final int digital_Display = 0; switch (state.value) {
public final int analog_Display = 1; case State.Display :
public final int Set_hours = 2;
LCD.display_digital_time();
public final int Set_minutes = 3;
public int value; LCD.display_blink_hours();
} state.value = State.set_hours;
public class Watch { break;
private State state = new case State.Set_hours :
State(); LCD.display_blink_minutes();
state.value = State.Set_minutes;
private Digital_display LCD =
break;
new Digital_display();
case State.Set_minutes :
public Watch() { LCD.display_digital_time();
state.value = state.value =
State.digital_Display; State.digital_Display;
break;
LCD.display_time(); 284
}
Public void A() {
switch (state.value){
case state.set_hour :
Case state.set_minutes:
break;
case state.analog_display:
LCD.display.digital_time();
break;
case state.digital_display:
LCD.display_analog_time();
break;
}
285
}
Bonus Problem 27-8-14
How to handle composite AND
and OR states?
286
Package Diagrams
• A package is a grouping
of several classes:
– Java packages are a good Order Capture
AWT
Mailing List
UI UI
example
• Package diagrams show
module dependencies.
• Useful for large projects Order Capture Mailing List
Application Application
with multiple binary files
Dependency
Common
{global}
Oracle Quantity
Interface Money Domain
DateRange
Sybase
Database Orders Customers
Interface
Interface
{abstract}
287
Component Diagram
Captures physical structure of
the implementation.
Purpose:
Organize source code
Librarian
Librarian
289
Component Diagram
Captures the physical structure of the
implementation (code components)
UML 1.X
Notation
dependency
Components:
• Executables
• Library
• Table
• File
• Document
290
Ball and Socket notation for Interfaces
Ball and socket notation is new in UML 2.0.
Components that consume (require) an interface:
Display a "socket" labeled with the interface
name .
Components that provide (implement) an
interface:
Display a "ball" labeled with the interface name.
Combining the two:
A compact way to say that Consumer talks
to the provider via the named interface. 291
Component Diagram: Example
Library
UI Librarian DB
292
Deployment Diagram
The deployment diagram shows:
How a software system will be physically
deployed in the hardware environment.
Its main purpose is:
Show where the different components of the
system will physically run and
How they will communicate with each other.
Since the diagram models the physical
runtime:
A system's operation staff will make
293
considerable use of this diagram.
Deployment Diagram
Node:
Something that can host an artifact.
A node represents a physical machine.
To model a node, draw a three-dimensional cube
with the name of the node at the top.
Physical nodes should be labeled with the
stereotype device
Artifact:
Files, assemblies, DLL, or scripts
294
An artifact is usually a component
Deployment Diagram
Captures the topology of a system’s
hardware
A piece of
hardware
295
Architectural Modeling Using
Deployment Diagram
Terminal
2 Terminal
Terminal X
1
Branch
Server ATM X
Terminal
1
ATM 2
ATM 1
Terminal
X
296
New Notations in UML 2
UML 2 was a major revision of the
UML standard.
Five
represent different aspects of
dynamic behavior
Class Diagram
Object Diagram
Component Diagram
Deployment Diagram
299
299
UML Behavior diagrams
Use Case Diagram
Sequence Diagram
Activity Diagram
Communication Diagram
Packages
Component diagram
Deployment diagram
301
301
UML 2.0 Highlight of Changes
list is not comprehensive
:Foo :Bar
xx
305
Classes: Active and Passive
In UML 2, there can be:
Passive classes: as usual
Active classes: classes with defined
behaviour, and that can react to arriving
signals.
Denoted with double vertical borders.
ClassName ActiveClass
Attributes Attributes
Operations Operations
306
A passive class An active class
Signals and Channels
Signals can be sent between active classes.
A signal is defined by a class with the
stereotype <<signal>>.
Signals can carry parameters.
Sending and receiving a signal:
Somewhat analogous to calling a method in another
object.
instance name
OutPort
Switch2 : Switch
class name
InPort
310
Composite Structure
311
Composite Structure Diagram
Lets you capture how a class is defined by a
further structure of classes
and the communication paths between these parts.
312
Tools Supporting UML 2.0
PlantUML
Open Source ArgoUML
ARTiSAN's Real-time Studio
Borland Together 2006 for Eclipse
Computas' Metis with UML 2.0 Template
Embarcadero Describe
IBM Rational Software Architect and Modeler
I-Logix Rhapsody
MetaMatrix MetaBase Modeler
Mia Software Model-in-Action
313
No Magic's MagicDraw UML
Tools Supporting UML 2.0 continued……..
317
OOAD
OOA OOD/OOP
Domain
Specification Definition Model Construction
of of Program
Use
the problem case the solution
model
3
OOA versus OOD?
Analysis:
An elaboration of requirements.
Independentof any specific
implementation
Design:
A refinement of the analysis model.
Takesimplementation constraints into
account
4
Design Process
OOA OOD
User interface
Use case Interaction
Issues or GUI
prototype diagram diagram
Start
Glossary
5
Two dimensions of RUP
6
Using UML in the OO Process
7
Domain Model Relationships
Conceptual Class Diagram
Domain Model
Define terms
Domain
Use Case Model objects Glossary
Functional Requirements
Interaction Diagrams
Dynamic Behavior
8
Domain Modelling
Represent concepts or objects
Control
Withdrawal
manager
Entity
Account 10
Domain model vs.
Design Class Diagram – What difference?
Register Sale
Domain 1 captures *
Model
time
… isComplete:Boolean
total
Conceptual
Perspective
15
Use Case Realization
17
Identification of Boundary Objects
Need one boundary object :
For every actor-use case pair
register
Customer customer Clerk
Manager Supermarket
Prize scheme 18
Identification of Controller Objects
Examine the use case diagram:
Add one controller class for each use case.
Some controllers may need to be split into two
or more controller classes if they get assigned
too much responsibility.
register
Customer customer Clerk
register
Play Move sales
Sales Clerk
select
Tic-tac-toe game
Player winners
Supermarket
Manager Prize scheme
19
Identification of Entity Objects
Usually appear as nouns in the problem
description.
From the list of nouns, need to exclude:
Users (e.g. accountant, librarian, etc)
Passive verbs (e.g. Acknowledgment)
Those with which you can not associate any data to
store
Those with which you can not associate any methods
Usually:
Appear as data stores in DFD
SalesHistory CustomerRegister
1 1
* *
SalesRecords CustomerRecord
Play Move
Tic-tac-toe game
Player
28
Example 1: Initial and Refined
Domain Model
Board
29
Example 1: Sequence Diagram
:playMove :playMove
Boundary Controller
:board
acceptMove checkMoveValidity
move
[invalidMove] [invalidMove]
announceInvalidMove
announceInvalidMove checkWinner
[game over]
[game over] announceResult
announceResult
playMove
checkWinner
[game over] [game over]
announceResult announceResult
displayBoardPositions getBoardPositions
[game not over]
promptNextMove
Systematize development of
interaction diagram of complex
use cases.
Responsibility:
Collaborator:
BookRegister
FindBook Book
CreateBook Book
Reserve Book
Responsibility Collaborator
Execute a scenario :
A class is responsible to perform some
responsibilities
It may then pass control to a
collaborator -- another class
You may discover missing responsibilities and36
classes
Example 1: Class Diagram
Board PlayMoveBoundary
int position[9]
checkMove Validity announceInvalidMove
checkResult announceResult
playMove displayBoard
Controller
announceInvalidMove
announceResult
37
Example 2: Supermarket Prize Scheme
Supermarket needs to develop software
to encourage regular customers.
Customer needs to supply his:
Residence address, telephone number, and
the driving licence number.
Each customer who registers is:
Assigneda unique customer number (CN)
by the computer. 38
Example 2: Supermarket Prize Scheme
A customer can present his CN to the
staff when he makes any purchase.
register
Customer customer Clerk
register
sales
Sales Clerk
select
winners
Manager Supermarket
Prize scheme 41
Example 2: Initial Domain Model
SalesHistory CustomerRegister
1 1
* *
SalesRecords CustomerRecord
* *
SalesRecords CustomerRecord
RegisterCustomerBoundary RegisterCustomerController
RegisterSalesBoundary RegisterSalesController
SelectWinnersBoundary SelectWinnersControllers
Select
SelectWinners
Winners
SelectWinners
*computeSales
*browse
register
register
checkDuplicate
*match
[duplicate]
showError
generateCIN
create :Customer
register
Record
displayCIN
RegisterSales registerSales
registerSales
create :Sales
Record
confirm
confirm
46
Sequence Diagram for the register sales use case
Example 2: Sequence Diagram for the
Register Sales Use Case
:Register
:Sales
Sales
History
Boundary
registerSales
RegisterSales
create :Sales
Record
confirm
selectWinners findWinnerDetails
registerSales register
1 1
* *
SalesRecords CustomerRecord
salesDetails name
address
computerSales browse
browse checkDuplicate48
create create
Video Rental Store Software
A video rental store has a large collection of video CDs and DVDs in VHS and
MP4 format as well as music CDs.
A person can become member a member by depositing Rs. 1000 and filling up
details such as name, address, and telephone number. A member can cancel his
membership and take back his deposit, if he has no dues outstanding against him.
Whenever the store purchases a new item, details such as price and date of
procurement are entered. The daily rental charge is also entered by the
manager. After passage of a year, the daily rental charge is automatically halved.
A member can, at a time, take on loan at most two video CDs and one music CD.
The details are entered by a store clerk and a receipt indicating the daily rental
charge should be printed by the software.
Whenever a member returns his loaned item(s), the due amount to be paid is
displayed. After the amount is paid, the items are marked returned.
If a customer loses or damages any item, the full price of the item is charged to
him and the item is removed from the inventory.
If an item is not lent out by anyone for even once over a year, the item is sold
at 10% of the purchase price and is removed from the inventory.
49
The manager can, at any time, check the profit/loss account.
Personal Library System
The software is required to manage the collection of books by individuals.
A person can have a few hundreds of books. The details of all the books such as
name of the book, year of publication, date of purchase, price, and publisher
must be entered. A book is to be given a unique serial number by the computer
which would be written by the owner using a pen on the book. Before a friend can
be lent a book, he must be registered. The registration data would include name
of the friend, address, land line number, and mobile number. Before a friend is
issued a book, the various books outstanding against him also with the date
borrowed are displayed. The date of issue and the title of the book are stored.
When a friend returns a book, the date of return is stored and the book is
removed from his borrowing list. Up on query, the software should display the
name, address, and telephone numbers of each friend against whom books are
outstanding along with the titles of the outstanding books and the date on which
those were issued.
The owner of the library software, when he borrows books from his friends,
would enter the details regarding the title of books borrowed, and the date
borrowed. Similarly, the return details of books would be entered. The software
should be able display all the books borrowed from various friends. The owner
should be able to query about the availability of a particular book, the total50
number of books in the personal library,
IIT Security Software
The staff and students of IIT register their vehicle by filling up a form which
a security staff would enter into the system.
Each time a vehicle enters or leaves the campus, a camera reads the
registration number of the car, and the model of the car. If the car is
registered, the check gate should lift automatically to let in (or out) the vehicle.
The details regarding the entry and exit of the vehicle are registered in the
database. For outside vehicles, the driver needs to enter the purpose of entry,
the model number, the registration number, and a photograph of the vehicle is
stored in the database.
When an outside vehicle leaves the campus, the details are automatically
registered in the database. For any external vehicle that is inside the campus for
more than 8 hours, the driver is stopped by the security personnel manning the
gate, queried to satisfaction, and the response are recorded. Considering that
there have been several incidence of speeding and rough driving, the security
personnel are empowered to telephone the registration number of errant
vehicles to the main gate. For outside vehicles, the driver is quizzed at the check
gate and his future entry is barred if the response is not satisfactory. For inside
vehicles, a letter is issued to the dean to deal with the employee or student as
the case might be.
The security officer can check the data regarding the number of vehicles
going in and coming out of the campus (over a day, month or year), the total 51
number of vehicles currently inside the campus.
Students’ Auditorium Management Software
Various types of social and cultural events are conducted in the
student auditorium. There are two categories of seats: balcony and
ordinary seats. The maximum number of balcony seats that can be
booked per ticket is 2.
The show manager fixes the prices of the two categories of seats
for a specific show, depending on the popularity of a show.
The show manager also enters the show dates, the number of shows
on any particular date and the show timings. It is expected that
the software would support a functionality to let the show manager
configure the different show parameters.
Based on this data, the system should schedule the repair of the road depending on the
priority of the repair work and subject to the availability of raw material, machines, and
personnel.
This schedule report is used by the supervisor to direct different repair work.
The manpower and machine that are available are entered by the city corporation
administrator. He can change these data any time.
The progress of the work is entered periodically by the supervisor which can be seen by
the citizens in the web site.
The mayor of the city can request for various road repair statistics such as the number
and type of repairs carried out over a period of time and the repair work outstanding at
any point of time and the utilization statistics of the repair manpower and machine over
any given period of time. 56
Bookshop Automation Software
BAS should help the customers query whether a book is in stock. The users can
query the availability of a book either by using the book title or by using the
name of the author.
If the book is not currently being sold by the book-shop, then the customer is
asked to enter full details of the book for procurement of the book in future.
The customer can also provide his e-mail address, so that he can be intimated
automatically by the software as and when the book copies are received.
If a book is in stock, the exact number of copies available and the rack number
in which the book is located should be displayed. If a book is not in stock, the
query for the book is used to increment a request field for the book.
BAS should maintain the price of various books.
As soon as a customer selects his books for purchase, the sales clerk would
enter the ISBN numbers of the books. BAS should update the stock, and
generate the sales receipt for the book.
BAS should allow employees to update the inventory whenever new supply
arrives.
Upon request by the owner of the book shop, BAS should generate sales
statistics (viz., book name, publisher, ISBN number, number of copies sold,57and
the sales revenue) for any period.
Program Testing
03/08/10 1
Name Any Four Defect Reduction
Techniques…
• Review
• Testing
08/10/1003/08/10
Dilbert: Scott Adams
Error Tit-Bits
• Experienced programmers on the
average make:
50 errors per 1000 lines of source code
Test automation
Ack www.dstb.dk
Testing Perception
• Testing often viewed as not very
challenging --- less preferred by
novices, but:
Over the years testing has taken a center
stage in all types of software development.
Large number of innovations have taken
place in testing area --- requiring tester to
have good knowledge of test techniques.
Challenges of test automation
Testing Activities
Error, Faults, and Failures
• A failure is observed during
testing:
A manifestation of an error
(also called defect or bug).
Time
• Another way:
Seed bugs… run test cases
See if all (or most) are getting
detected
When You Ask Testers to Hurry Up…
12/30/2021
Testing Levels
• Software tested at three
levels:
Unit testing
Integration testing
System testing
Test Levels
• Unit testing
Test each module (unit, or component)
independently
Mostly done by developers of the modules
• Integration and system testing
Test the system as a whole
Often done by separate testing or QA team
• Acceptance testing
Validation of system functions by the
28
customer
Overview of Activities During System
and Integration Testing
• Test Suite Design
• Run test cases Tester
• Check results to detect failures.
• Prepare failure list
• Debug to locate errors
Developer
• Correct errors.
Quiz 1
• As testing proceeds more and more bugs
are discovered.
How to know when to stop testing?
Integration testing?
System testing?
Unit testing
• During unit testing, functions (or
modules) are tested in isolation:
What if all modules were to be tested
together (system testing)?
1000*(0.3)4=81 bugs
Quiz 2
• Certain testing carried out over 5 testing stages
• Each stage can detect 60% of the defects present
at that time.
• Immediately after each testing stage, and before
the next testing stage starts:
Bug fixes are carried out.
Each bug fix has a 15% chance of creating a new bug.
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
V Life Cycle
Model
12/30/2021
V Model
• It is a variant of the Waterfall
emphasizes verification and
validation
V&V activities are spread over the
entire life cycle.
• In every phase of development:
Testing activities are planned in
parallel with development.
Project& Production,
Requirements Operation &
Planning Maintenance
Product System&
Requirements& Acceptance
Specification Testing
Analysis
Architecture Integration&
High Level Testing
Design
Detailed Unit
Design testing
Coding
V Model Steps
• Planning
• Integration and
• Design
Testing
V Model: Strengths
• Starting from early stages of
software development:
• Easy to use
V Model Weaknesses
• Does not support overlapping of
phases
• Does not support iterations
• Does not easily handle later changes
in requirements
• Does not support risk analysis
activities
When to use V Model
• Natural choice for systems
requiring high reliability:
Example: embedded control
applications
“Relax, our
engineers have found
and corrected
85% of the flaws.”
Evolution of Test Automation
1960-1990 1990-2000 2000-
Model-Based
Testing
Scripting
Capture and
Replay
Persistence Junit/SQLUnit/XMLUnit
Layer
58
Ack www.dstb.dk
Fault Model
• Types of faults possible in a
program.
Structural
Algorithmic
Faults
Faults
Industry experts
Why Design of Test Cases?
• Exhaustive testing of any non-trivial
system is impractical:
• If (x>y) max = x;
else max = x; // should be max=y;
40%
Quiz 4: How would you
use this for planning test
Problems effort?
Detected 25%
15%
10%
10%
10% 10%
F1 F2 F3 F4 F5 F5
Unit Testing
03/08/10 81
When and Why of Unit Testing?
• Unit testing carried out:
Debugging cost
increases
substantially…
Unit Testing
• Each part tested
individually and
independently
• Scope is smaller,
easier to locate and
fix errors…
Unit Testing
• Testing of individual methods, modules,
classes, or components in isolation:
Before they are integrated with other
parts of the software being developed.
• Units testing needs:
Driver
• Simulates the behavior of a function that calls
and possibly supplies some data to the Driver
function being tested.
Unit
Stub Stub
PROCEDURE
STUB DRIVER
CALL UNDER TEST CALL
Verification
Validation
Design of Unit Test Cases
• There are essentially three main
approaches to design test cases:
Black-box approach
Grey-box approach
Black-Box Testing
• Test cases are designed using only
functional specification of the
software: Input
Software Output
03/08/10 92
Black box testing
• Considers the software as a black box:
Test data derived from the specification
• No knowledge of code necessary
03/08/10 95
Equivalence Class Partitioning
• The input values to a program:
Partitioned into equivalence classes.
Valid Invalid
Equivalence Partitioning
• Further partition valid and invalid
test cases into equivalence classes
Equivalence Partitioning
• Create a test case for at least one
value from each equivalence class
Equivalence Class Partitioning
• If the input data to the program is
specified by a range of values:
e.g. numbers between 1 to 5000.
SQRT
Example (cont.)
1 5000
Example (cont.)
• The test suite must include:
Representatives from each of the
three equivalence classes:
• Etc.
Equivalence Partitioning: Example 2
Input Valid Equivalence Invalid Equivalence
Classes Classes
A integer N such
that:
-99 <= N <= 99 ? ?
Phone Number
Area code: [11,
999] ? ?
Suffix: Any 6 digits
Equivalence Partitioning: Example 4
Input Valid Equivalence Classes Invalid Equivalence Classes
yrs of ed.
Strong Equivalence Class Testing
age
Yrs of ed.
Strong Robust Equivalence Class
Testing
age
yrs of ed.
Quiz 7
• Design Equivalence class test cases:
• A bank pays different rates of interest on
a deposit depending on the deposit period.
3% for deposit up to 15 days
4% for deposit over 15days and up to 180
days
6% for deposit over 180 days upto 1 year
7% for deposit over 1 year but less than 3
years
8% for deposit 3 years and above
Quiz 8
• Design Equivalence class test cases:
• For deposits of less than Rs. 1 Lakh, rate of
interest:
6% for deposit upto 1 year
7% for deposit over 1 year but less than 3 years
8% for deposit 3 years and above
substr(s1,s2);
Boundary Value
Testing
03/08/10 117
Boundary Value Analysis
• Some typical programming errors occur:
150 at maximum
Independent Data
• Suppose there are 2 “distinct” inputs that are
assumed to be independent of each other.
Input field 1: years of education ( say 1 to 23 )
Input field 2: age (1 to 150)
age
yrs of ed.
- Note that there needs to be only 9 test cases for 2
independent inputs.
- In general, need (4z + 1) test cases for z independent inputs.
Boundary Value Test
Given F(x,y) with constraints a x b
c y d
Boundary Value analysis focuses on the boundary
of the input space to identify test cases.
Use input variable value at min, just above min, a
nominal value, just above max, and at max.
y
d
x
Single Fault Assumption
• Premise: “Failures rarely occur as the
result of the simultaneous occurrence
of two (or more) faults”
• Under this:
Char / 0 1 2 3 4 5 6 7 8 9 :
ASCII 47 48 49 50 51 52 53 54 55 56 57 58
Robustness testing
• This is just an extension of the Boundary Values
to include:
Less than minimum
Greater than maximum
Y
- Note that there needs to be only 13 test cases for 2 independent
variables or inputs.
- In general, there will be (6n+ 1) test cases for n independent inputs.
Some Limitations of Boundary Value Testing
False
• Equivalence classes
Invalid Equation
Complex
Valid Equation: Roots? Coincident
Real
Unique
Decision Table
Testing
03/08/10 138
Combinatorial Testing: Motivation
• The behavior of a program may be affected
by many factors:
Input parameters,
Environment configurations, and
State variables.
• Equivalence partitioning and boundary-value
analysis:
Identify the possible values of individual
factors.
• In fact, it is impractical to test all possible
combinations of values of all factors.
Decision table-based Testing (DTT)
• Applicable to requirements involving
conditional actions.
• Can be automatically translated into code
Rule1 Rule2 Rule3 Rule4
Condition2
Yes
Yes
Yes
X
No
No
No
Actions = outputs
Condition3 No Yes No X
Action3 No No No Yes
Action3 No No No Yes
Sample Decision table
• A decision table consists of a
number of columns (rules) that r1 r2 … rn
comprise all test situations
• Action ai will take place if c1 and C1 0 1 0
c2 are true
c2 - 1 0
• Example: the triangle problem
C1: a, b,c form a triangle C3 - 1 1
C2: a=b C4 - 1 0
C3: a= c
a1 1 0 0
C4: b= c
A1: Not a triangle a2 0 1 1
A2:scalene
a3 0 0 0
A3: Isosceles
A4:equilateral
a4 0 1 1
A5: impossible
a5 0 0
Test cases from Decision Tables
Test Case Expected
ID a b c output
DT1 4 1 2 Not a
Triangle
DT2 2888 2888 2888 Equilateral
DT3 ? | ) Impossible
DT4
…
DT11
Decision Table for the Triangle
Problem
Conditions
C1: a < b+c? F T T T T T T T T T T
C2: b < a+c? - F T T T T T T T T T
C3: c < a+b? - - F T T T T T T T T
C4: a=b? - - - T T T T F F F F
C5: a=c? - - - T T F F T T F F
C6: b-c? - - - T F T F T F T F
Actions
A1: Not a Triangle X X X
A2: Scalene X
A3: Isosceles X X X
A4: Equilateral X
A5: Impossible X X X 144
Test Cases for the Triangle Problem
Case ID a b c Expected
Output
DT1 4 1 2 Not a
Triangle
DT2 1 4 2 Not a
Triangle
DT3 1 2 4 Not a
Triangle
DT4 5 5 5 Equilateral
DT5 ? ? ? Impossible
DT6 ? ? ? Impossible
DT7 2 2 3 Isosceles
DT8 ? ? ? Impossible
DT9 2 3 2 Isosceles
DT10 3 2 2 Isosceles
145
DT11 3 4 5 Scalene
Decision Table – Example 2
Printer does not print Y Y Y Y N N N N
Printer is unrecognized Y N Y N Y N Y N
Printer Troubleshooting
Quiz 11: Develop BB Test Cases
• Policy for charging customers for
certain in-flight services:
more than
N N N N Y Y Y Y
half-full
CONDITONS
more than
Rs.3000 per N N Y Y N N Y Y
seat
domestic
N Y N Y N Y N Y
flight
ACTIONS
Analyze column by column to determine which
actions are appropriate for each combination
POSSIBLE COMBINATIONS
domestic flight N Y N Y N Y N Y
ACTIONS
serve meals X X X X
free X
Reduce the table by eliminating
redundant columns.
POSSIBLE COMBINATIONS
more than
N N N N Y Y Y Y
half-full
CONDITONS
domestic flight N Y N Y N Y N Y
ACTIONS
serve meals X X X X
free X
Final solution
Combinations
domestic flight - - N Y
ACTIONS
serve meals X X X
free X
Assumptions regarding rules
Rules need to be complete:
• That is, every combination of decision
table values including default
combinations are present.
c5 e2
e20
c1 e30 e3
c2 e40
e4
c3 e50
e60
Develop a Decision Table
C1 C2 C3 C4 C5 e1 e2 e3 e4
1 0 0 1 0 1 0 0 0
1 0 0 0 1 0 1 0 0
0 1 0 1 0 0 1 0 0
0 1 0 0 1 1 0 1 0
• Convert each row to a test case
Capture/Playback Tools
• Automated test tools mimic actions of the tester.
• 2 Open a test:
To create a new test,
click on New
To open an existing test,
click on Open
Sprint\zXC
abcde
Selenium: History
• Developed in 2004 by Jason Huggins as a JavaScript
library used to automate his manual testing routines
• Selenium Core is born whose functionality underlies the
Selenium RC (Remote Control) and Selenium IDE tools
• The Limitation of having a JavaScript based automation engine
and browser security restricted Selenium to specific
functionality
Selenium.
Selenese
Script
Editor
Accessor
Area
Selenium Log
Recoding a Selenium Test Case
• Open Firefox that has the IDE installed
• Open the base URL of the application to record.
• Keep the application in a common base state.
• Go To Tools Selenium IDE and the IDE will be
opened
• Now perform the operations on the application as
you are testing the application.
• Once you are done with the recording
Click on the stop recording button and save the test case
through the file menu.
By default it will be saved as a selenese script (HTML
167
Cons of Capture/Replay
• High maintenance costs:
Software change can mean many script
changes
• Fair amount of effort to produce
scripts:
Similar for each test procedure
Duplication of effort and high
maintenance costs 168
Duplicated Script
12/30/2021 169
Data-driven Testing
• Test data separated from scripts
Placed into separate data files
12/30/2021 171
Example Key-word Test
12/30/2021 172
Data-Driven versus Keyword Driven Testing
• These frameworks are similar in that the
data is separated from the test script
• The script is just a "driver" or delivery
mechanism for the data.
• The difference:
In keyword-driven testing, the navigation data
and test data are contained in the data source
03/08/10 176
Combinatorial Testing
0 = effect off
1 = effect on
X1 X2 X3 . . . Xn
System S
90
80
70
% detected
60
50
40
30
20
10
0
1 2 3 4
Interaction
How about other applications?
• Browser
100
90
80
70
60
% detected
50
40
30
20
10
0
1 2 3 4 5 6
Interactions
How about other applications?
• Server
100
90
80
70
60
% detected
50
40
30
20
10
0
1 2 3 4 5 6
Interactions
How about other applications?
• NASA distributed database
100
90
80
70
60
% detected
50
40
30
20
10
0
1 2 3 4 5 6
Interactions
How about other applications?
•TCAS
100
90
80
70
60
% detected
50
40
30
20
10
0
1 2 3 4 5 6
Interactions
When a Tester Works Too Well…
13 3 1.6 x 106 15
40 3 1.2 x 1019 21
187
Fault-Model
• A t-way interaction fault:
Triggered by a certain combination of t
input values.
190
Multi-mode Faults
• Multi-mode faults
• end
• Expected: x = x1 and y = y1 => f(x, y, z) – g(x, y);
192
x = x2, y = y2 => f(x, y, z) + g(x, y)
A larger example
• Suppose we have a system with 34 on-off switches:
Example: Android smart phone testing
• Apps should work on all combinations of platform options,
but there are 3 x 3 x 4 x 3 x 5 x 4 x 4 x 5 x 4 = 172,800
configurations
HARDKEYBOARDHIDDEN_NO ORIENTATION_LANDSCAPE
HARDKEYBOARDHIDDEN_UNDEFINED ORIENTATION_PORTRAIT
HARDKEYBOARDHIDDEN_YES ORIENTATION_SQUARE
ORIENTATION_UNDEFINED
KEYBOARDHIDDEN_NO
KEYBOARDHIDDEN_UNDEFINED SCREENLAYOUT_LONG_MASK
KEYBOARDHIDDEN_YES SCREENLAYOUT_LONG_NO
SCREENLAYOUT_LONG_UNDEFINED
KEYBOARD_12KEY SCREENLAYOUT_LONG_YES
KEYBOARD_NOKEYS
KEYBOARD_QWERTY SCREENLAYOUT_SIZE_LARGE
KEYBOARD_UNDEFINED SCREENLAYOUT_SIZE_MASK
SCREENLAYOUT_SIZE_NORMAL
NAVIGATIONHIDDEN_NO SCREENLAYOUT_SIZE_SMALL
NAVIGATIONHIDDEN_UNDEFINED SCREENLAYOUT_SIZE_UNDEFINED
NAVIGATIONHIDDEN_YES
TOUCHSCREEN_FINGER
NAVIGATION_DPAD TOUCHSCREEN_NOTOUCH
NAVIGATION_NONAV TOUCHSCREEN_STYLUS
NAVIGATION_TRACKBALL TOUCHSCREEN_UNDEFINED
NAVIGATION_UNDEFINED
NAVIGATION_WHEEL
Quiz 14
• Design black-box test suite for a
function that accepts two strings of
size upto 10 characters and reports
the number of times the second
string occurs in the first string.
End
03/08/10 196
Cause-Effect Graphing
Example: Control motion module in the automated
train software project
1. List and label all Causes and all effects
Causes Effects
C1: Start e100: Release all Brakes
C2: Idle e200: Engage_Engine
C3: speed = Max_speed e300: Disengage_Engine
C4:Accelerating e400: Apply Ph. 1 Brakes
C5: Speed > Max_speed e500: Release Ph. 1 brakes
C6: Coasting e600: Apply Ph. 2 brakes
C7: Speed <= Min_speed e700: Apply Safety brakes
Software Testing Techniques
Speed > Max_speed /
Apply Ph. 1 brakes
Coasting Decelerating
Speed <= Speed = Max_speed / Stop /
Min_speed/ Disengage_Engine
Engage
Engine
stopping
Accelerating
Speed = Stopping_Speed
Start / Rlease all Braks
Engage Engine
Idle Applying ph II
Cause-Effect Graphing
c1 e10 e100
c2 e200
c3 e20 e300
c4
e40 c5 e30 e400
c7 c6
White-Box Testing
03/08/10 1
What is White-box Testing?
• Fault-based:
Design test cases to expose
some category of faults
White-Box Testing
• Several white-box testing strategies have
become very popular :
Statement coverage
Branch coverage
Path coverage
Condition coverage
MC/DC coverage
Mutation testing
Data flow-based testing
Why Both BB and WB Testing?
Black-box White-box
• Impossible to write • Does not address the
a test case for
every possible set of question of whether
inputs and outputs a program matches
• Some code parts the specification
may not be • Does not tell if all of
reachable
the functionality has
• Does not tell if been implemented
extra functionality
has been • Does not uncover any
implemented. missing program logic
Coverage-Based Testing Versus Fault-
Based Testing
• Idea behind coverage-based testing:
Design test cases so that certain program
elements are executed (or covered).
Example: statement coverage, path
coverage, etc.
• Idea behind fault-based testing:
Design test cases that focus on
discovering certain types of faults.
Example: Mutation testing.
Types of program element Coverage
• Statement: each statement executed
at least once
• Branch: each branch traversed (and
every entry point taken) at least once
• Condition: each condition True at least
once and False at least once
• Multiple Condition: All combination of
Condition coverage achieved
• Path:
• Dependency:
Stronger and Weaker Testing
Coverage
Stronger
Weaker
Complementary Testing
Coverage
Strategy 1
Strategy 2
Stronger, Weaker, and
Complementary Testing
Complementary
Weaker
Statement Coverage
• Statement coverage
strategy:
• {(x=3,y=3),(x=3,y=2),
(x=4,y=3), (x=3,y=4)}
Branch Testing
• Adequacy criterion: Each branch
(edge in the CFG) must be
executed at least once
• Coverage:
# executed branches
# branches
Quiz 1: Branch and Statement
Coverage: Which is Stronger?
digit_high == 1 || digit_low == -1
Basic Condition
• Branch testing:
Decision
Test a b c d e
Case 5
2 =32
(1) T — T — T
(2) F T T — T
(3) T — F T T
(4) F T F T T
(5)
(6)
F
T
F
—
—
T
T
—
T
F
•Short-circuit
(7) F T T — F evaluation often
—
(8) T F T F
reduces number of test
(9) F T F T F
(10) F F — T F cases to a more
(11) T — F F — manageable number,
(12) F T F F —
(13) F F — F — but not always…
Modified Condition/Decision Coverage (MC/DC)
• Motivation: Effectively test important
combinations of conditions, without
exponential blowup in test suite size
“Important” combinations means: Each basic
condition shown to independently affect the
outcome of each decision
• Requires:
For each basic condition C, two test cases
Values of all evaluated conditions except C are
the same
Compound condition as a whole evaluates to
true for one and false for the other
Test Coverage Criteria
Condition/Decision Coverage Subsumption hierarchy
Condition: true, false.
Decision: true, false. MCC
Multiple Condition coverage (MCC)
all possible combinations of condition
outcomes in a decision MC/DC
for a decision with n conditions
2n test cases are required Condition/Decision
Modified Condition/Decision coverage
(MC/DC)
Decision
Bug-detection effectiveness almost
similar to MCC
Statement
Linear growth in number of test cases
required.
What is MC/DC?
• MC/DC stands for Modified Condition /
Decision Coverage
• A kind of Predicate Coverage technique
Condition: Leaf level Boolean expression.
Decision: Controls the program flow.
• Main idea: Each condition must be
shown to independently affect the
outcome of a decision.
The outcome of a decision changes as a
result of changing a single condition.
Multiple Condition Coverage
(MCC)
• Every condition in the decision has
taken all possible outcomes at least
once.
Requirement 2:
Requirement 3:
true false
As in Branch coverage.
40
MC/DC Requirement 2
• Every condition in the decision has taken
all possible outcomes at least once.
If ( ( a ) && (( b ) || ( c )) ) then…
If ( ( a ) && (( b ) || ( c ) )) then…
Test a b c d e outcome
Case
(1) true -- true -- true true
(2) false true true -- true true
(3) true -- false true true true
(6) true -- true -- false false
(11) true -- false false -- false
(13) false false -- false -- false
Note: We want to
determine the MINIMAL
set of test cases
Here:
• {2,3,4,6}
•{2,3,4,7}
• Defined in terms of
Control flow graph (CFG) of a
program.
Path Coverage-Based Testing
• To understand the path coverage-
based testing:
We need to learn how to draw control
flow graph of a program.
• A control flow graph (CFG) describes:
The sequence in which different
instructions of a program get executed.
The way control flows through the
program.
How to Draw Control Flow Graph?
• Number all statements of a program.
• Numbered statements:
Represent nodes of control flow graph.
• An edge from one node to another node
exists:
If execution of the statement
representing the first node can result
in transfer of control to the other
node.
Example
int f1(int x,int y){
1 while (x != y){
2 if (x>y) then
3 x=x-y;
4 else y=y-x;
5 }
6 return x; }
Example Control Flow
Graph
1
3 4
5
6
How to Draw Control flow Graph?
• Every program is composed of:
Sequence
Selection
Iteration
• If we know how to draw CFG
corresponding these basic
statements:
We can draw CFG for any program.
How to Draw Control flow
Graph?
• Sequence:
1 a=5; 1
2 b=a*b-1;
2
How to Draw Control Flow
Graph?
• Selection:
1 if(a>b) then 1
2 c=3;
3 else c=5; 2 3
4 c=c*c;
4
How to Draw Control Flow
Graph?
• Iteration:
1
1 while(a>b){
2 b=b*a;
3 b=b-1;} 2
4 c=b+d;
4
Example Code Fragment
Do
{
if (A) then {...};
else {
if (B) then {
if (C) then {...};
else {…}
}
else if (D) then {...};
else {...};
}
}
While (E);
Example Control Flow Graph
True
True
B
C D
True True
E
True
6
Cyclomatic Complexity
• Another way of computing
cyclomatic complexity:
inspect control flow graph
determine number of bounded areas
in the graph
• V(G) = Total number of bounded
areas + 1
Any region enclosed by a nodes and edge
sequence.
Example Control Flow Graph
1
3 4
6
Example
• From a visual examination of
the CFG:
Number of bounded areas is 2.
Cyclomatic complexity = 2+1=3.
Cyclomatic Complexity
• McCabe's metric provides:
• A quantitative measure of testing
difficulty and the ultimate reliability
• Intuitively,
Number of bounded areas increases
with the number of decision nodes
and loops.
Cyclomatic Complexity
• The first method of computing
V(G) is amenable to automation:
You can write a program which
determines the number of nodes
and edges of a graph
3 4
5
6
Derivation of Test Cases
• Number of independent paths: 3
1,6 test case (x=1, y=1)
statement
weakest coverage
condition branch
coverage (or decision)
coverage
multiple- condition
coverage
only if paths across composite
conditions are distinguished
strongest path
coverage
Data Flow-Based Testing
• Selects test paths of a
program:
According to the locations of
•Definitions and uses of
different variables in a
program.
Data Flow-Based Testing
• For a statement numbered S,
DEF(S) = {X/statement S contains a
definition of X}
USES(S)= {X/statement S contains a use
of X}
Example: 1: a=b; DEF(1)={a}, USES(1)={b}.
Example: 2: a=a+b; DEF(1)={a},
USES(1)={a,b}.
Data Flow-Based Testing
• A variable X is said to be live
at statement S1, if
X is defined at a statement S:
There exists a path from S to
S1 not containing any definition
of X.
DU Chain Example
1 X(){
2 a=5; /* Defines variable a */
3 While(C1) {
4 if (C2)
5 b=a*a; /*Uses variable a */
6 a=a-1; /* Defines variable a */
7 }
8 print(a); } /*Uses variable a */
Definition-use chain (DU
chain)
• [X,S,S1],
S and S1 are statement numbers,
X in DEF(S)
X in USES(S1), and
the definition of X in the
statement S is live at statement
S1.
Data Flow-Based Testing
• One simple data flow testing
strategy:
Every DU chain in a program be
covered at least once.
• Data flow testing strategies:
Useful for selecting test paths of a
program containing nested if and loop
statements.
Data Flow-Based Testing
• 1 X(){
• 2 B1; /* Defines variable a */
• 3 While(C1) {
• 4 if (C2)
•5 if(C4) B4; /*Uses variable a */
•6 else B5;
•7 else if (C3) B2;
•8 else B3; }
• 9 B6 }
Data Flow-Based
Testing
• [a,1,5]: a DU chain.
• Assume:
DEF(X) = {B1, B2, B3, B4, B5}
USED(X) = {B2, B3, B4, B5, B6}
There are 25 DU chains.
• However only 5 paths are needed to
cover these chains.
Summary
• Exhaustive testing of almost
any non-trivial system is
impractical.
we need to design an optimal
test suite that would expose
as many errors as possible.
Summary
• If we select test cases
randomly:
Many test cases may not add to the
significance of the test suite.
• There are two approaches to
testing:
black-box testing
white-box testing.
Summary
• Black box testing is also known as
functional testing.
• Designing black box test cases:
Requires understanding only SRS
document
Does not require any knowledge about
design and code.
• Designing white box testing requires
knowledge about design and code.
Summary
• We discussed black-box test
case design strategies:
Equivalence partitioning
Boundary value analysis
• We discussed some important
issues in integration and system
testing.
Test Automation
Software Testing Effort
Utilize Automated Testing Strategies
50% or More of Overall Development and Technology to Improve Productivity
Cost is Typically Spent on Testing and Quality
Spiral / Release 4
Size & Complexity of SW Baseline
Reduction in
Spiral / Release 3 Test Days
Spiral / Release 2
%
Test
Days
%
Spiral / Release 1 Test
Days
%
Test
Day
Size Manual vs.
% Automated
Test
Day
Increased Test
Coverage
Evolution of Testing Techniques
1960- 1990-2000 2000-
1990
Model-Based
Testing
Scripting
Capture and
Replay
• 2 Open a test:
To create a new test,
click on New
To open an existing test,
click on Open
Sprint\zXC
abcde
Keyword View
Selenium.
•Selenium is used for treating Mercury Poisoning 108
Selenium IDE - UI
Selenese
Script
Editor
Accessor
Area
Selenium Log
Recoding a Selenium Test Case
• Open Firefox that has the IDE installed
• Open the base URL of the application to
record.
• Keep the application in a common base
state.
• Go To Tools Selenium IDE and the IDE
will be opened
• Now perform the operations on the
application as you are testing the
Running Your First Selenium Script
• Make sure the application is in the common
base state.
Froglogic http://www.froglogic.com/pg?id=Google&category=squ
ishjava
Redstone Software Eggplant
KD Executor http://www.kdab.net/?page=products&sub=kdexecutor
Jameleon http://sourceforge.net/projects/jameleon/
ShUnit2 for shell scripts testing
GNU Linux Desktop Project http://ldtp.freedesktop.org/wiki/Home
Cantana http://www.ipl.com/pdf/p0003.uk.pdf
crontab Part of Unix
crontab, cruisecontrol,
www.adminschoice.com/docs/crontab.htm
Dogtail http://people.redhat.com/zcerza/dogtail/about.html
http://www.cyberciti.biz/tips/linux-automated-gui-
testing-with-python-based-dogtail-tool.html
White-Box Testing ---
Mutation Testing, Integration and
System Testing,Testing Object-
oriented Programs, Test Automation
1
Mutation Testing
• In this, software is first tested:
8
Fault Model of an OO Program
OO Faults
Structural
Faults Algorithmic
Faults
9
Traditional Mutation Operators
• Deletion of a statement
• Boolean:
• Replacement of a statement with another
eg. == and >=, < and <=
13
The Coupling Effect
Program If program is
not error-free,
Create fix it
Mutants Test
Process
Mutation
Mutation Tests
Problem
New Test
with
Mutant Test Tests?
Cases
Mutants
Yes
Mutants that are
Any Live Test
caught by tests are
killed Mutants? No Complete
15
Equivalent Mutants
• There may be surviving mutants that
cannot be killed,
– These are called Equivalent Mutants
• Although syntactically different:
– These mutants are indistinguishable through
testing.
• Therefore have to be checked ‘by hand’
while... while...
... ...
i++ i++
if (i==5) if (i>=5)
break; break; 16
Disadvantages of Mutation Testing
18
Quiz 1: Solution
• Identify two advantages and two
disadvantages of the mutation test technique.
• Adv:
– Can be automated
– Helps effectively strengthen black box and coverage-
based test suite
• Disadv:
– Equivalent mutants
– Effective only against minor syntactic bugs
19
Debugging
• Once errors are identified:
– Debug: Identify precise location of errors
– Fix errors
– Regression test
33
Static Analysis Tools
• Static analysis tools:
–Assess properties of a
program without executing it.
38
Integration Testing Approaches
• Develop the integration plan by
examining the structure chart :
–big bang approach
–top-down approach
–bottom-up approach
–mixed approach 39
Example Structured Design
root
Valid-numbers rms
rms
Valid-numbers
Get- Validate-
data data
40
Big Bang Integration Testing
• Big bang approach is the simplest
integration testing approach:
• In bottom-up approach:
–Testing can start only after
bottom level modules are ready. 46
System Testing
• There are three main types
of system testing:
–Alpha Testing
–Beta Testing
–Acceptance Testing 47
Alpha Testing
• System testing carried out
by the test team within the
developing organization.
49
Acceptance Testing
• System testing performed by
the customer himself:
57
Quiz 2
• 100 errors were introduced.
• 90 of these errors were found
during testing
• 50 other errors were also
found.
• Find errors remaining in code. 58
Quiz 2: Solution
• 100 errors were introduced.
• Remaining errors=
50 (100-90)/90 = 6
59
Error Seeding
• The kinds of seeded errors should
match closely with existing errors:
–However, it is difficult to predict the
types of errors that exist.
62
Need for Regression Testing
• Any system during use undergoes
frequent code changes.
– Corrective, Adaptive, and Perfective
changes.
• Regression testing needed after
every change:
– Ensures unchanged features continue
63
to work fine.
Partitions of an Existing Test Suite
To
Obsolete
Tu
Redundant
Tor Tr
Optimized Regression Tests
Regression
Tests
64
Major Regression Testing Tasks
• Test revalidation (RTV):
– Check which tests remain valid
• Test selection (RTS):
– Identify tests that execute modified
portions.
• Test minimization (RTM):
– Remove redundant tests.
• Test prioritization (RTP):
65
Step #4: Define, select, and reuse test cases to form a regression
test suite
Software Change
Impact Analysis
Define Regression
Testing Strategy
Build Regression
Test Suite
Run Regression
Tests at different levels
Report Retest
Results
67
Automating regression testing
Build results
Test for version x
data
Build tests
for version x
Run tests
for version x Compare Verdict
68
69
70
Introduction
• More than 50% of development effort is being
spent on testing.
– on thoroughness of testing.
• Class level:
Derived
Faculty Students Staff
Classes
context of a subclass
Derived
Faculty Students Staff
Classes
• Example: if we change a
method show-address() UnderGrad PostGrad Research
•Can only be
Derived
indirectly tested Faculty Students Staff
Classes
through classes
derived from it.
UnderGrad PostGrad Research
•So can never be
considered as fully
89
tested.
Polymorphism
• Each possible binding of a polymorphic
component requires separate testing:
C S1 S3
S2 91
Dynamic Binding
• Dynamic binding implies:
m15
m
m51
m5
m55
94
State-Based Testing
• The concept of control flow of a
conventional program :
• In a state model:
order received
Unprocessed
Order
[reject] checked [accept] checked
Rejected Accepted
Order Order
[some items available]
[some items not processed / deliver
available] processed
[all items
Pending available] Fulfilled
Order newsupply Order
108
A OUTPUT PORT EVENT
Class 3
Class 1 A
meth1 meth2
1
meth1
meth2 meth3
B
B
2
Class 2
meth1 meth3
3
MM-Path
Message meth2
109
Use Case-based Integration
• Begin by testing classes that use
services of none (or a few) of other
classes.
115
Testing Based on UML Models
• UML has become the de facto standard for OO
modeling and design:
• Though UML is intended to produce rigorous
models:
– Does incorporate many flexibilities.
– Incomplete, inconsistent, and ambiguous
models often result.
• Never the less:
– UML models are an important source of
116
information for test design.
Use Case Diagram
• Use cases roughly capture
system level requirements.
• A collection of use cases defines:
–Complete functionality of the
system.
117
Use Case Diagram
cont...
retested.
Sequence Diagram
• A sequence diagram documents message
exchanges in time dimension.
coverage.
Activity Diagram cont...
• Statechart model:
– Provides most of the information
necessary for class-level state-based
testing. 126
Component Diagram
• Shows the dependency relationships among:
– Components,
– Physical containment of components,
– Interfaces and calling components.
• The basic testing practice with respect to
component diagrams:
– All call paths should be identified and
exercised. 127
Deployment Diagram
• Represents hardware, software, and network
architecture.
– Useful in integration planning.
• When a component runs on a node,
– Test cases should exercise whether a
component can be loaded and run on each
designated host node.
• When a node communicates with another node,
– Test cases should exercise open, transmit, and
close communication for each remote 128
component.
Test Coverage Criteria Based on UML
Models
• Generalization criterion
130
Software Testing Effort
Utilize Automated Testing Strategies
50% or More of Overall Development and Technology to Improve Productivity
Cost is Typically Spent on Testing and Quality
Spiral / Release 4
Size & Complexity of SW Baseline
Reduction in
Spiral / Release 3
Test Days
Spiral / Release 2 %
Test
Days
%
Spiral / Release 1 Test
Days
%
Test
Day
%
Test
Size Manual vs.
Automated
Day Increased
131Test
Coverage
Evolution of Testing Techniques
1960- 1990-2000 2000-
1990
Model-Based
Testing
Scripting
Capture and
Replay
136
Monkey Testing
• 2 Open a test:
– To create a new test,
click on New
– To open an existing test,
click on Open
Sprint\zXC
abcde
140
Keyword View
141
Expert View
142
Selenium: History
• Developed in 2004 by Jason Huggins as a JavaScript
library used to automate his manual testing routines
• Selenium Core is born whose functionality underlies the
Selenium RC (Remote Control) and Selenium IDE tools
• The Limitation of having a JavaScript based automation engine
and browser security restricted Selenium to specific
functionality
Selenium.
•Selenium is used for treating Mercury Poisoning
144
144
Selenium IDE - UI
Selenese
Script
Editor
Accessor
Area
Selenium Log
145
Recoding a Selenium Test Case
• Open Firefox that has the IDE installed
• Open the base URL of the application to record.
• Keep the application in a common base state.
• Go To Tools Selenium IDE and the IDE will be
opened
• Now perform the operations on the application as you
are testing the application.
• Once you are done with the recording
– Click on the stop recording button and save the test case
through the file menu.
– By default it will be saved as a selenese script (HTML 146
format)
Running Your First Selenium Script
• Make sure the application is in the common
base state.
QF-Test http://www.qfs.de/en/qftestJUI/index.html
Froglogic http://www.froglogic.com/pg?id=Google&category=squis
hjava
KD Executor http://www.kdab.net/?page=products&sub=kdexecutor
Jameleon http://sourceforge.net/projects/jameleon/
ShUnit2 for shell scripts testing
GNU Linux Desktop Project http://ldtp.freedesktop.org/wiki/Home
Cantana http://www.ipl.com/pdf/p0003.uk.pdf
crontab Part of Unix
crontab, cruisecontrol,
www.adminschoice.com/docs/crontab.htm
Dogtail http://people.redhat.com/zcerza/dogtail/about.html
http://www.cyberciti.biz/tips/linux-automated-gui-
testing-with-python-based-dogtail-tool.html 151
Expect http://expect.nist.gov/
Software Quality
Assurance
2
The Quality Gurus – Edward Deming
•Quality is
“uniformity and
dependability”
•Focus on SPC
and statistical
tools
•“14 Points” for
1900-1993
1986 management
3
The Quality Gurus – Joseph Juran
•Quality is
“fitness for use”
•Pareto Principle
•Cost of Quality
•General
management 1904 - 2008
approach as well
1951 as statistics
4
The Quality Gurus – Phillip Crosby
Quality is free . . .
5
Introduction
How is a quality product
traditionally defined?
Fitness of purpose:
6
Fitness of Purpose
What is fitness of purpose for
software products?
Satisfaction of the requirements specified
in SRS document…
7
Fitness of Purpose
Basically user’s view…
A satisfactory definition of quality
for many products:
A car, a table fan, a food mixer,
microwave oven, etc.
Reusability
Maintainability 11
Correctness
When do you call a software
correct?
Ifthe requirements specified in the SRS
document have correctly been
implemented.
14
Usability
When do you say that a software
has good usability?
User view:
Fitness for purpose.
Manufacturing view:
Conformance to requirements and “Right the first time” to
avoid costs of rework … theme of ISO 9000, SEI CMM etc
Product view:
if a product is manufactured with good internal characteristics
then it will have good external qualities.
Value-Based view:
The central view in this case is how much a customer is willing
17
17
to pay for a certain level of quality.
Two Accepted Definition of “Software
Quality”
IEEE Glossary:
Degree to which a system, component, or
process meets (1) specified requirements, and
(2) customer or user needs or expectations
ISO:
The totality of features and characteristics
of a product or service that bear on its ability
to satisfy specified or implied needs
18
Quality Models
19
Boehm’s Quality Model
20
Boehm’s Quality Model (continued)
23
ISO 9126 Quality Characteristics
Quality Characteristic Definition
Usability A set of attributes that bear on the effort needed for use and on the
individual assessment of such use by a stated or implied set of users
Efficiency A set of attributes that bear on the relationship between the software
performance and the amount of resources used under stated conditions
Maintainability A set of attributes that bear on the effort needed to make specified
modifications (which may include corrections, improvements, or
adaptations of software to environmental changes and changes in the
requirements and functional specifications)
Correctness properties
Internal properties
Contextual properties
Descriptive properties 25
Dromey Quality Model Framework
Linking product properties to quality attributes
26
The current status of software quality
Microsoft Windows XP End-User License Agreement:
11. LIMITED WARRANTY FOR PRODUCT ACQUIRED IN THE US AND
CANADA.
Microsoft warrants that the Product will perform substantially in
accordance with the accompanying materials for a period of ninety days
from the date of receipt.
(…)
If an implied warranty or condition is created by your state/jurisdiction and
federal or state/provincial law prohibits disclaimer of it, you also have an
implied warranty or condition, BUT ONLY AS TO DEFECTS DISCOVERED
DURING THE PERIOD OF THIS LIMITED WARRANTY (NINETY DAYS).
(…)
Some states/jurisdictions do not allow limitations on how long an implied
warranty or condition lasts, so the above limitation may not apply to you.
(…)
YOUR EXCLUSIVE REMEDY. Microsoft's and its suppliers' entire liability and
your exclusive remedy shall be, at Microsoft's option from time to time
exercised subject to applicable law, (a) return of the price paid (if any) for
the Product, or (b) repair or replacement of the Product, that does not meet
this Limited Warranty and that is returned to Microsoft with a copy of your
receipt.
(..)
This Limited Warranty is void if failure of the Product has resulted from
accident, abuse, misapplication, abnormal use or a virus. 27
Quantitative Targets For Managing US Defense Projects
Original fault density <4 per function point >7 per function point
Total program <3 pages per function >6 pages per function
documentation point point
28
Software Quality Management System
29
Quality Management Activities
Quality assurance
set of activities for ensuring quality of the processes by which
software is developed
Quality planning
selecting and modifying applicable quality standards and
procedures for a particular project
Quality control
series of inspections, reviews, and tests used to ensure
conformance of a work product to its specifications
ensuring quality standards and procedures are followed by
development team
Note: Quality management should be separated from project
management to ensure independence. 30
Definition
Q. What is Quality Planning ?
31
Definition
Q. What is Quality Assurance
32
Definition
Q. What is Quality Control
33
Software Quality Assurance
Monitoring processes and products throughout
the software development lifecycle to ensure the
quality of the delivered product(s)
Monitoring the processes
Monitor and provide management with objective
feedback regarding process compliance to approved
plans, procedures, standards, and analyses
Monitoring the products
Focus on the quality of product within each phase of
the SDLC
e.g., requirements, test plan, architecture, etc.
Objective: identify and remove defects throughout
the lifecycle, as early as possible 34
Process Assessment
Use of standards and process models has a positive
impact on the quality of the software product
Disciplined, controlled development process
Examples include:
ISO 9001
CMM
CMU SEI, 5 levels
SPICE
A standard for software process assessment
ISO joint committee, Europe, Australia
44
Preparation
Individual activity
Author collects all material required
for inspection
Inspectors study the material and
complete inspection log.
Defects are noted at this step, but
not collected…
45
Meeting
Meeting is conducted by moderator
Agenda includes:
Introduction
Establishing readiness
Examining material and recording defects
Review defects
Determine disposition
Debrief
48
Follow-up
Moderator verifies that corrections
are made
Moderator completes inspection
management report and defect
summary report
49
Inspection Roles
Author – developer of work product
Moderator – an inspector responsible for
organizing and reporting on inspection
Reader – an inspector who guides the
examination of the product
Recorder – an inspector who enters all the
defects found on the defect list
Inspector – Member of inspection team. Often
chosen to represent specific role- designer,
tester, technical writer, SQA, etc 50
Reviewer Roles
review
leader standards bearer (SQA)
producer
maintenance
oracle
recorder reviewer
user rep
52
53
Conducting the Review
1. be prepared—evaluate thoroughly before the review
55
Metrics Collected from Reviews
inspection time per page of documentation
inspection time per KLOC or FP
Managerial Structure
Individual Responsibilities.
59
Quality Management System
Every quality conscious organization has
an independent quality department:
Performs several quality system activities.
Needs support of top management.
Withoutsupport at a high level in a
company:
Many employees may not take the quality
system seriously.
60
Quality System Activities
Auditing of projects
Development of:
standards, procedures, and guidelines.
Production of reports for the top
management:
Summarizing the effectiveness of the
quality system in the organization.
Review of the quality system itself. 61
62
Quality System
A good quality system must be well
documented.
Without a properly documented
quality system,
Application of quality procedures
become ad hoc,
Results in large variations in the quality
of the products delivered. 63
Quality System
An undocumented quality system:
Sends clear messages to the staff about
the attitude of the organization towards
quality assurance.
67
Evolution of Quality Systems
Initial product inspection method:
Gave way to quality control (QC).
Quality control:
Notonly detect the defective
products and eliminate them
Butalso determine the causes
behind the defects. 68
Quality Control (QC)
Quality control aims at correcting the
causes of errors:
Not just rejecting defective products.
Statistical quality control (SQC):
Inspection
or testing of all products is
cumbersome and many times not
feasible.
Quality of the output of the process
is inferred using statistical methods. 69
Scope of Quality Disciplines
Software Quality Engineering
Software Testing
70
71
Quality Control (QC)
The next breakthrough:
Development of quality
assurance principles.
72
Quality Assurance
Basic premise of modern quality
assurance:
TQM advocates:
Continuous
process
improvements through
process measurements.
75
76
Business Process Reengineering
80
Process Attributes
Pr ocess D escription
cha racteristic
U nderstandability To w hat extent is the process explici tl y defined and how easy is it to
understand the process definition?
V isibil ity D o the process activ ities culmi nate in cl ear resul ts so that the progress
of the process is external ly visible?
Supportability To w hat extent can C ASE tools be used to support the process
activ ities?
A cceptability Is t he defined process acceptable to and usable by the engi neers
responsibl e for producing the softw are product?
R eliability Is the process designed i n such a w ay that process errors are av oided or
trapped before they result in product errors?
R obustness C an the process conti nue in spite o f unexpected problems?
M aintainability C an the process ev olv e to reflect changi ng organisati onal requirements
or identifi ed process imp rovements?
R apidity How fast can the process of del iv ering a system from a giv en
specification be comp leted? 81
The Process Improvement Cycle
Measure
Change Analyse
82
Process Improvement Stages
Process measurement
Attributes of the process are measured.
Form a baseline for assessing
improvements.
Process analysis
The process is assessed and bottlenecks
and weaknesses are identified.
Process change
Changes to the process that have been
identified during the analysis are
83
introduced.
Process and Product Quality
A good process is usually required to
produce a good product.
For manufactured goods, process is
the principal quality determinant.
For design-based activity, other
factors are also involved:
For example, the capabilities of the
designers. 84
85
ISO 9000
ISO (international Standards
Organization):
A consortium of 63 countries
established to formulate and foster
standardization.
88
The ISO 9000 Family
ISO 9000 is a family of standards for quality
management systems
Originated in manufacturing, they are now employed
across a wide range of other types of organizations
Some of the requirements in ISO 9001 (which is one of
the standards in the ISO 9000 family) include
Documenting all key processes in the business;
monitoring processes to ensure they are effective;
keeping adequate records;
checking output for defects, with appropriate corrective
action where necessary;
regularly reviewing individual processes and the quality system
89
itself for effectiveness; and
ISO Family of Standards
ISO 9001:2000 Basis for certification
ISO 9004:2000 to prepare for national quality award
ISO 10006 for project management
ISO 10007 for configuration management
ISO 10012 for measurement systems
ISO 10013 for quality documentation
ISO/TR 10014 managing economics of Quality
ISO 10015 for training
ISO/TS 16949 for automotive suppliers
ISO 19011 for auditing
90
What is ISO 9000 Certification?
ISO 9000 certification:
Serves as a reference for
contract between independent
parties.
The ISO 9000 standard:
Specifiesguidelines for
maintaining a quality system. 91
What is ISO 9000 Certification?
ISO 9000 specifies:
Guidelinesfor repeatable and high
quality product development.
Also
addresses organizational
aspects
Responsibilities, reporting, procedures,
processes, and resources for
implementing quality management. 92
ISO 9000
A set of guidelines for the
production process.
Notdirectly concerned about
the product it self.
A series of three standards:
ISO 9001, ISO 9002, and ISO
9003. 93
ISO 9000
Based on the premise:
Ifa good production process is
followed:
Good quality products are bound
to follow.
94
ISO 9001
Applies to:
Organizations engaged in design,
development, production, and
servicing of goods.
Applicable
to most software
development organizations.
95
ISO 9002
ISO 9002 applies to:
Organizations who do not design products:
but are only involved in production.
97
ISO 9000 Structure
ISO 9000
ISO 9003
ISO 9002 Quality System Model
ISO 9001 Quality System Model for
Quality System Model for for Quality Assurance
Quality Assurance in in final inspection and
Quality Assurance in design, production, installation, and
development, production, test
servicing
installation and service
ISO 9000-3
Guidelines for the application
of ISO 9001 to the design,
development and maintenance
of software
98
ISO 9000 for Software Industry
ISO 9000 is a generic standard:
Applicable to many industries,
Starting from a steel manufacturing
industry to a service rendering company.
100
Software vs. Other Industries
Software is intangible:
Therefore difficult to control.
It is difficult to control anything that we cannot
see and feel.
In contrast, in a car manufacturing unit:
We can see a product being developed through
stages such as fitting engine, fitting doors, etc.
One can accurately tell about the status of the
product at any time.
Software project management is an
altogether different ball game… 101
Software vs. Other Industries
During software development:
The only raw material consumed is data.
For any other product development:
Lot of raw materials consumed
e.g. Steel industry consumes large volumes of iron
ore, coal, limestone, etc.
103
ISO 9000 Looks Great on Brochures…
104
ISO 9000 Part-3
ISO released a separate document
called ISO 9000 part-3 in 1991:
Tohelp interpret the ISO standard
for software industry.
At present:
Official guidance is inadequate.
105
ISO 9001: A Quick History
i. Original Standard in 1987
a) 20 clauses
b) Procedure-based
ii. Revision in 1994
a) A “tweak”
iii. Revision in 2000
a) Major overhaul
b) 8 sections
c) Focus on the Customer
d) Focus on Business Results
iv. Revision in 2008
106
A “tweak”
http://www.iso.org/iso/about.htm
a)
ISO 9000: 2000
ISO 9001:2000:
Combines the three standards 9001, 9002, and
9003 into one.
Design and development procedures are
required:
Only if a company does in fact engage in the
creation of new products.
The 2000 version sought to make a radical
change in thinking:
By actually highlighting the concept of process
107
management.
ISO 9000: 2000
An important goal is now to improve
effectiveness via process performance
metrics:
Numericalmeasurement of the
effectiveness of tasks and activities.
Continualprocess improvement and
tracking customer satisfaction were
made explicit.
108
The 2008 “Tweak”
ISO 9001:2008 did not introduce additional
requirements
Nor did it change the intent of the ISO
9001:2000 standard.
ISO 9001:2008 was developed in order to:
Introduce clarifications to the existing
requirements of ISO 9001:2000 and
Introduce changes that are intended to improve
compatibility with ISO 14001:2004, Environmental
109
Management Systems.
Clarification Examples
From To
Regulatory Requirements Statutory and regulatory
requirements
Equipment Devices
Conformity of the product Conformity of the product to
requirements
110
ISO 9000 Process model
111
112
Certification and registration
Certification is known in some countries as
registration.
Enter
surveillance
mode 117
Why Get ISO 9000 Certification?
In Europe (and elsewhere) only buy from
certified companies to ensure safety
Telecommunications equipment
Medical devices
Gas appliances
Toys
Construction products
Required for international competitiveness
Not to mention all of the other benefits of
trying to improve quality 118
Why Get ISO 9000 Certification?
119
Why Get ISO 9000 Certification?
Requires a well-documented software
production process to be in place.
Contributes to repeatable and higher
quality software.
Makes development process:
Focussed, efficient, and cost-effective
120
Why Get ISO 9000 Certification?
Points out the weakness of an
organizations:
Recommends remedial action.
Pre-assessment:
Theregistrar makes a rough
assessment of the organization.
124
How to Get ISO 9000
Certification?
Document review and adequacy
audit:
Process
and quality-related
documents.
The registrar reviews the documents.
Makes suggestions for improvements.
125
Process Documentation…
126
How to Get ISO 9000
Certification? Compliance Audit
127
Auditor at work…
128
ISO 9000 Audit….
129
ISO 9000 Audit….
130
How to Get ISO 9000
Certification?
Registration:
Continued surveillance:
Theregistrar continues monitoring
the organization periodically. 131
ISO 9000 Certification
An ISO certified organization :
Canuse the certificate for corporate
advertizements.
Cannot use the certificate to advertize
its products.
ISO 9000 certifies organization's process
Not any product of the organization.
143
Purchaser Supplied Products (4.7)
Material supplied by a
purchaser:
For example,
Client-provided software must
be properly managed and
checked. 144
Product Identification (4.8)
146
147
Inspection and Testing (4.10)
In software terms this requires
effective testing i.e.,
Unittesting, integration testing and
system testing.
148
Inspection, Measuring and Test
Equipment(4.11)
149
Control of Nonconforming Product
(4.13)
In software terms,
Keepinguntested or faulty
software out of released
product.
150
Corrective Action (4.14)
This is both about correcting errors
when found:
Investigating why they occurred
Improvingthe process to prevent further
occurrences.
153
The focus is documents…
154
Salient Features of ISO 9001
Requirements:
All documents concerned with the
development of a software product:
Shouldbe properly managed,
authorized, and controlled.
instantiated as
documents
Organization Organiza tion
quality manual quality process
Supports 158
Quality Standards
Key to effective quality management
Clear
link between process quality and
product quality.
Once a process is calibrated:
Can be run again and again producing quality
goods.
Software development is a creative
process:
Individualskills and experience is
164
significant.
Shortcomings of ISO 9001
Certification (5)
Many areas of software development
Intranets
SEI CMM
167
SEI Capability Maturity Model (CMM)
o Mission is to foster
improvement of software
processes
175
Capability Evaluation
Provides a way to assess the
software process capability of
an organization:
Helps in selecting a contractor
Management
PROCESSES
Staff Technology
• An uncontrolled Control
process cannot be Define
improved Measure
• Attempting to Execute
improve an Process
unstable process Adapted from SEI
yields further
instability
179
SEI Capability Maturity Model
The SEI CMM classifies software
development industries into:
Five maturity levels.
Stages are ordered so that
improvements at one stage provide
foundations for the next.
Based on the pioneering work of Philip
Crosby. 180
SEI Capability Maturity Model
Optimizing (5)
Managed (4)
Defined (3)
Repeatable (2)
Initial (1)
181
Improvement Framework
Productivity and Quality Optimizing - Level 5
Total Organization Involvement Continuous
Improvement
Managed - Level 4
Quantifiable Predictability Quantitative
Understanding
Defined - Level 3
Engineering
Consistency
Process
Focus
Repeatable - Level 2
Management
Disciplined
Process
Initial - Level 1
Chaos
Capability Maturity ModelSM Version 1.1
182
Improvement Framework
Optimizing - Level 5
Defect Prevention
Technology Change Mgmt
Process Change Mgmt.
Productivity
and Managed - Level 4
Quality
Quantitative Process Management
Software Quality Management
Defined - Level 3
Organization Process Focus Organization Process Definition
Training Program Integrated Software Management
Software Product Engineering Intergroup Coordination
Peer Reviews
Repeatable - Level 2
Requirements Management Software Project Planning
Software Project Tracking & Oversight Subcontract Management
Software Quality Assurance Software Configuration
Management
Initial - Level 1
183
184
Level 1: (Initial)
Organization operates
Without any formalized process
or project plans
Configuration management
Subcontract management
203
CMM Level 2 KPAs
Software
Requirements
Quality
Management Assurance
Software Software
Project Configuration
Planning Management
Software Software
Project Tracking Subcontract
and Oversight Management 204
L2
Level 3 KPAs
Process definition and
documentation.
Reviews
Training program
205
CMM Level 3 KPAs
Organization Organization
Process Process
Focus Definition
Integrated Software
Software Product
Management Engineering 206
Level 4 KPAs
Quantitative measurements.
Quantitative Process
management.
control process performance quantitatively
given module
Actual man-hours expended for
designing/coding the module
Estimated number of hours to run builds
for a given release
Actual number of hours spent running
builds for the release 211
Examples of measurements of quality
of the work product
Kick-Off
Meeting
Organizational
Review
Documents
Project
Implementation
Project Leaders
Interviews
Middle Managers
Practitioners
SEPG
Findings Findings
Presentation Next Steps
Legend
= Activities completed
prior to on-site visit
215
Typical Assessment
On-site Period
Day 1 Day 2 Day 3 Day 4 Day 5
216
Benefits of CMM
• Win more projects due to customers’
trust
• Make large international projects
possible
• Risk mitigation
• Improved project quality
• Make projects success possible when
team members dynamically change. 217
Cons of CMM
High cost: training, writing documents
and synchronizing practice and
documents
% Succeeded
Projects
CMM
1 2 3 4 5 Level
Cost
CMM
1 2 3 4 5 Level 218
Con: Becoming stamp of approval
Some organizations want CMM only
as a stamp of approval:
226
So Many Models, So Little Time
• Different structures,
formats, terms, ways
YA- of measuring
Software CMM
EIA 731 maturity
CMM
• Causes confusion,
Systems especially when using
Engr more than one model
CMM
People
CMM • Hard to integrate
IPD Software them in a combined
CMM Acq
CMM improvement program
• Hard to use multiple
FAA Systems
iCMM Security models in supplier
Engr CMM selection 227
CMMI (CMM Integrated)
CMMI is the successor of the CMM.
CMM was developed from 1987--1997.
In 2002, CMMI Version 1.1 was
released.
Version 1.2 followed in August 2006.
The goal of CMMI is to integrate many
different models into one framework.
Itwas created by members of industry,
government and the SEI. 228
Three Flavours of CMMI
CMMI for Development
Development and maintenance of products
Integrates software engineering, systems
engineering, collaborative teams, acquisition from the
supplier’s side
Not just for software development!
CMMI for Services
Organizations that provide services (from taxis to
call centers)
CMMI for Acquisition
Acquiring products and services
Common Process Areas are embedded within all
229
three
The CMMI Solution
A Product Line Approach
SW SE
Industry
Government
Assess
Most of the goals are specific to the process area, but there are
some generic or “global” goals that are common to all of the
Process Areas 234
Process Areas by Maturity Level
Maturity Level Process Areas
5 Optimizing Organizational Innovation and Deployment
Causal Analysis and Resolution
4 Quantitatively Managed Organizational Process Performance
Quantitative Project Management
3 Defined Requirements Development Technical Solution
Product Integration Verification
Decision Analysis and Resolution Validation
Organizational Process Focus
Organizational Process Definition +IPPD
Organizational Training
Integrated Project Management +IPPD
Risk Management
2 Managed Requirements Management
Project Planning
Project Monitoring and Control
Supplier Agreement Management
Measurement and Analysis
Process and Product Quality Assurance
Configuration Management 235
1 Initial
4 CMMI Process Areas
Process Management (5 processes)
Organizational Process Focus
Organizational Process Definition
Organizational Training
Organizational Process Performance
Organizational Innovation and Deployment
Project Management (8 processes)
Project planning
Project Monitoring and Control
Supplier Agreement Management
Integrated Project Management
Risk Management
Integrated Teaming
Integrated Supplier Management
236
Quantitative Project Management
4 CMMI Process Areas (cont.)
Engineering: (6 processes)
Requirements Management
Requirements Development
Technical Solution
Product Integration
Verification
Validation
Support: (6 processes)
Configuration Management
Process and Product Quality Assurance
Measurement and Analysis
Organizational Environment for Integration
Decision Analysis and Resolution 237
Causal Analysis and Resolution
Staged Model and Maturity Levels (MLs)
ML5:Optimizing
1. Organizational Innovation & Deploy
2. Causal Analysis & Resolution
ML4:Quantitatively
Managed 1. Organizational Process Performance,
2. Quantitative Proj. Mgmt
ML3:Defined
1. Req. Development, 2. Technical solutions, 3. Product
Integration, 4. Verification, 5. Validation, 6.
Organizational Process Focus, 7. Organiz. Process
Definition, 8. Organiz. Training, 9. Integrated Proj.
Mgmt, 10. Risk Mgmt, 11.Integrated Teaming, 12.
Integrated Supplier Mgmt, 13. Decision Analysis and
ML2:Managed Resloution, 14. Organiz. Environment for Integration
2 flavours:
Continuous
Staged
239
CMMI: Continuous Representation
Enables comparisons across and among
organisations on a process area by
process area basis.
Migration:
Migration from CMM to CMMI is easy for staged
241
model.
What is a SCAMPIsm Appraisal?
SCAMPIsm – Standard CMMI Appraisal Method
for Process Improvement
70.0% 63.0%
60.0%
50.0%
40.0% 25.2%
30.0%
20.0% 1.3% 5.2%
10.0% 0.5%
0.0%
Level 1 Level 2 Level 3 Level 4 Level 5
243
SCAMPI Appraisal
Minimum team size is four - A Lead Appraiser and
three additional team members.
At least one team member must be from the appraised
organization.
All team members must be trained in the official
CMMI and SCAMPI courses
Conflicts of interest must be avoided
Exclude process authors and individuals directly impacted by
the outcome of the appraisal
Team members cannot be managers of any of the
selected projects or groups
Appraisal sponsors cannot be team members. 244
245
What does the SCAMPI Team do?
Reviews an organization’s documentation
Processes, procedures, policies, status
reports, meeting minutes
Conducts interviews
To ensure the documentation is actually used
PSP framework:
Helpssoftware engineers to measure
254
and improve the way they work.
Personal Software Process (PSP)
Helps developing personal skills and
methods.
Estimating and planning method.
Shows how to track performance against
plans.
Provides a defined process;
Can be fine tuned by individuals.
Recognizes that a process for individual use is
different from that for a team project. 255
Time Management
Track the way you spend time:
Boring activities seem longer than actual.
Interesting activities seem short.
Record time for:
Designing
Writing code
Compiling
Testing 256
Personal Software Process (PSP)
Planning
Design
Code Logs
Compile
Test
Project
Postmortem plan
summary
257
PSP-Planning
Problem definition
Estimate max, min, and total LOC
Determine minutes/LOC
Calculate max,min, and total
development times
Enter the plan data in project plan
summary form
Record the planned time in Log 258
PSP-Design
Design the program.
Record the design in specified
format.
Record the Design time in time
recording log.
259
PSP-Code
Implement the design.
Use a standard format for
code text.
Record the coding time in time
recording log.
260
PSP-Compile
Compile the program.
261
PSP-Test/Postmortem
Test:
Test the program.
Fix all the defects found.
Record testing time in time recording
log.
Postmortem:
Completeproject plan summary form
with actual time and size data.
Record postmortem time in time record. 262
Personal Software Process (PSP)
3 sigma: 3
Probability outside range = (1 – 0.99865) * 2 = 0.0027
Defect rate = 2,699 defects per million opportunities
6
6 sigma:
Probability part outside range = 0.00000000198024
Defect rate = 0.00197 dpm
1.97 defects per BILLION
266
Defect Rates - 1
3 sigma: 1/.0027 = 1 every 370 parts
6 sigma: 1/ 0.00000000198024
= 1 every 504.9 million parts
Pareto Chart:
Simple bar chart to represent defect
data
Used to identify the problems that occurs
with greatest frequency 269
Black Belts
Green Belts: some 6 sigma training,
take part in teams, small solo work
Schedule, and
Quality product.
Competition is challenging them to:
Reduce time for delivery
Adopt Six-Sigma methodology 272
Summary
Evolution of quality system:
Product inspection
Quality control
Quality assurance
Total quality management (TQM)
Quality paradigm change:
From product to process 273
Summary
ISO 9000:
Basic premise:
If a good process is followed
Good products are bound to follow.
Providesguidelines for
establishing a quality system.
274
Summary
ISO 9000:
Series of three standards
9001, 9002, and 9003
9001is applicable to software
industry.
275
Summary
SEI CMM
Developed specially for software
industry.
Classifies
software organizations into
five categories.
According to the maturity of their
development process.
CMMI: Integrates existing quality
techniques.
276
277
Defects - 2
With a 1.5σ shift, defect rates become:
3σ 66,807 dpm
6σ 3.4 dpm
The commonly accepted definition of 6σ quality is
having a defect rate <= 3.4 dpm
3 6
278
Software Reliability
12/30/2021 11
Introduction
Reliability of a software product:
a concern for most users especially industry
users.
An important attribute determining the quality
of the product.
Users not only want highly reliable
products:
want quantitative estimation of reliability
before making buying decision.
2
Introduction
Accurate measurement of
software reliability:
a very difficult problem
Several factors contribute to
making measurement of software
reliability difficult.
3
Major Problems in Reliability
Measurements
perceived reliability.
The 90-10 Rule
Experiments from analysis of behavior
of a large number of programs:
90% of the total execution time is spent
in executing only 10% of the instructions
in the program.
10
Difficulty in Software Reliability
Measurement (2)
15
Hardware vs. Software Reliability
Hardware failures:
inherently different from software
failures.
17
Hardware vs. Software
Reliability
Software faults are latent:
system will continue to fail:
unless changes are made to the
software design and code.
18
Hardware vs. Software Reliability
Because of the difference in
effect of faults:
20
Hardware vs. Software Reliability
Goal of hardware reliability study:
stability (i.e. interfailure times
remains constant)
22
Software Failure Curve
23
Reliability Metrics
Different categories of software
products have different reliability
requirements:
level of reliability required for a
software product should be
specified in the SRS document.
24
Reliability Metrics
A good reliability measure
should be observer-
independent,
27
Mean Time To Failure (MTTF)
MTTF is not as appropriate for
software as for hardware:
Hardware fails due to a component’s wear
and tear
thus indicates how frequently the component
fails
calculate (ti+1-ti)
MTTR:
MTBF=MTTF+MTTR
operating
systems, etc. which are
supposed to be never down
ROCOF
Time
44
Step Function Model
Assumes:
all
errors contribute equally to
reliability growth
highly unrealistic:
we already know that different errors
contribute differently to reliability
growth. 45
Jelinski and Moranda Model
Realizes each time an error is
repaired:
reliability
does not increase by a
constant amount.
Reliability improvement due to fixing
of an error:
assumed to be proportional to the
number of errors present in the system
46
at that time.
Jelinski and Moranda Model
Realistic for many applications,
still
suffers from several
shortcomings.
Mostprobable failures (failure
types which occur frequently):
discovered early during the testing
process.
47
Jelinski and Moranda Model
Repairing faults discovered early:
contribute maximum to the reliability
growth.
52
Applicability of Reliability Growth
Models
53
Statistical Testing
A testing process:
58
Step 2 in Statistical testing
Manually select or automatically
generate a set of test data:
59
Step 3 in Statistical testing
it
may not be appropriate to use raw
execution time
60
Step 4 in Statistical testing
61
Statistical Testing
Relies on using large test data
set.
Assumes that only a small
percentage of test inputs:
likely to cause system failure.
62
Statistical Testing
It is straight forward to generate
tests corresponding to the most
common inputs:
buta statistically significant
percentage of unlikely inputs should
also be included.
Creating these may be difficult:
especially if test generators are
63
used.
Advantages of Statistical Testing
Statistical uncertainty.
66
Summary
Reliability of a software product:
classes of inputs
Prof. R. Mall
Dept. of CSE, IIT, Kharagpur
1
Introduction
Technology developments occur too fast:
To adapt to new environments
To respond to new challenges
3
And technology changes very fast…
4
Background: Basic Software
Engineering Processes
Time Time
required = required = T2
T1
Change in the IT solution
Implementation in IT supporting
the business process
5
Background: Desired Goals
A. Reduce T1 (and improve quality)
B. Reduce T2
A requires:
Process should efficiently capture
requirements of the business and then
efficiently convert it to code.
B requires:
Implementation should be such that
business process changes can be easily
accommodated in the software solution.
6
Challenges Being Faced
Delivery time requirements are
shortening:
High business velocity requires this.
Softwareis becoming a bottleneck in
implementing business process changes.
Businesses are getting tired of software
cost, late deliveries, poor quality, risk,…
Hardwareand software cost differentials
are becoming more and more glaring. 7
Challenges Being Faced
cont…
Software sizes are further
increasing.
How software is to be effectively
developed in following contexts is
not yet clear:
Distributed platforms
Working with Internet
Distributed development teams 8
Data Interoperability Expands as
Response Time Shrinks
9
9
Noticeable Software Engineering
Technology Trends
Following software engineering
trends are easily noticeable:
Client-server
(or Component-
based) development
Service-Oriented Architecture
(SOA)
Software as a Service (SaaS) 10
Client-Server Technology
Both clients and servers are pieces
of software.
Concept of clients and servers is
12
Advantages of Client-Server
Compared to Traditional Software
Flexibility:
Clients
and servers can be easily
attached and removed.
Modularity
Concurrency
Cont…
Fault-tolerance 13
Advantages of Client-Server Compared to
Traditional Software
Server 1 Server m
Internet
Client n
Client 1
Middleware
Internet
Middleware
Client n
Client 1
18
Middleware Standards
CORBA and COM/DCOM
CORBA (common object
request broker architecture)
Being advocated by OMG
COM/DCOM:
Being advocated by Microsoft 19
CORBA Architecture
Server 1 Server m
Skeleton DSI Skeleton DSI
ORB
Object Adapter
Stub Stub
Client 1 Client n
20
CORBA Architecture
Skeleton:
Marshalls client requests
The servers register themselves with
the object-adapter.
The ORB delivers the client request to
the server.
The Skeleton marshalls the server response.
DII/DSI for dynamic service
21
invocation.
IDL: Interface Development
Language
Interfaces between clients and
servers can be specified.
Similar to C++ or Java:
But no executable statements.
Interface clock{
set-time(int hh, int mm, int ss);
get-time(int hh, int mm, int ss);
} 22
How to Develop Component-
Based Applications?
Divide application into
components.
Determine component interfaces:
Define using IDL.
Get available components:
Build the ones not available
Integrate components and test 23
CORBA Implementations
Visigenic
Iona
Orbix
Java IDL
…
24
COM/DCOM
COM used when an application runs on a
single machine:
DCOM for distributed machine.
Concepts are similar to CORBA:
Though terminologies are different.
Proxy on client side.
More usable than CORBA.
What is a component in COM/DCOM?
A .exe or .dll component
25
Created using VB or VC++
COM/DCOM versus CORBA
COM/DCOM strong on client side:
CORBA on server side.
Java Beans attempt to bridge this gap.
COM/DCOM more usable:
Ifyour application is to run only on
Microsoft operating systems, better
use COM/DCOM.
If
your application needs to run on
heterogeneous platforms, better use
26
CORBA.
Service-Oriented
Architecture (SOA)
27
Motivation
The ability to program the Web.
Example:
Consider an Excel spreadsheet that
summarizes the summary of your company’s
financial picture : stocks, bank accounts,
loans, etc.
If some of this information is available
through XML Web services, Excel can
update it and present the update information
to the shareholders.
28
Web Service definition
A simple definition:
“A piece of software available over Internet
that can be accessed using standardized
(i.e., XML) messaging system.”
Alternate definition:
“A Web Service is an application component
in the Web that is accessible using open
protocols”.
29
History
Web services evolved from previous
technologies that served the same
purpose such as DCOM, CORBA and
JAVA RMI.
Web Services were intended to solve
three main problems:
1. Interoperability
2. Firewall traversal
3. Complexity 30
Interoperability
Earlier distributed systems suffered
from interoperability issues because
each vendor implemented its own on-
wire format for distributed object
messaging.
DCOM apps strictly bound to Windows
Operating system.
RMI apps bound to Java programming
language. 31
SOA: Introduction
Service-orientation principles:
Rootsin object and component-
orientation.
Many claim that service-orientation
will replace object and component-
orientation:
Othersthink that the three are
complementary paradigms. 32
Firewall traversal
Collaboration across corporations was an
issue:
Because distributed systems such as CORBA
and DCOM used non-standard ports.
37
Services
Self contained and reusable units,
Can be reused to create new business
applications
Represent a high level business concept
Can be distributed over a network
Services can be independently evolved,
moved, scaled even in runtime.
Contain contract with specification of:
Purpose, functionality, interfaces, constraints,
38
Why SOA ?
Systems today are bigger than ever before
“Complexity increases exponentially with size”
Systems need to be interconnected
OO solved the problems of small-medium sized
systems
CO (Component Orientation) solved problems OO
couldn’t on medium-large systems
Neither OO nor CO could cope:
With the problems of very large systems,
Systems of systems, or integration between
39
3
systems
SOA vs. Component Model
Several things common between
services and components:
Multiple-use
Non-context-specific
Composable
Encapsulated --- non-investigable through
its interfaces
A unit of independent deployment and
versioning
40
Loose coupling
SOA vs. Component Model
cont…
Several things different.
Compared to components:
SOA's atomic-level objects are often 100
to 1,000 times larger.
Services may be developed and hosted
separately.
On the Internet
Distributed platforms
Possibly pay per use. 41
SOA vs. Component Model
cont…
Instead of services embedding calls to
each other in their source code:
Usedefined protocols which describe
how services can talk to each other.
This architecture relies on a business
process expert:
Links
and sequences services to meet a
new business requirement.
42
The process known as orchestration.
SOA vs. Component Model
cont…
Inefficient for:
Small – medium sized systems 44
4 Non-distributed systems
SOA Schematic
Service
Service
Service
Internet Service
Service Service
Service
45
SOA Characteristics
Loosely coupled:
Minimizes dependencies between services.
Contractual:
Adhere to agreement on service
descriptions.
Autonomous:
Control
the business logic they
encapsulate.
Abstract:
Hidethe business logic from the service
consumers. 46
SOA Characteristics
Reusable:
Dividebusiness logic into reusable
services.
Composable:
Facilitate assembly of composite services.
Stateless:
Minimize retained information specific to
an activity.
Discoverable:
Specifiedand registered so that they can
be found and assessed. 47
SOA: Nitty Gritty
An SOA-based application is a
collection of services:
Communicate with each other.
The services are self-contained:
Donot depend on the context or state of
the other service.
Each service works:
Withina distributed-system
architecture. 48
SOA : Nitty Gritty
cont…
52
source:IBM
SOA Entities
Service
Consumer
Contract Registry
Service
Provider
53
SOA Implementation
SOA can be implemented using:
Web services
Web services:
Form the functional building blocks
Accessible over standard Internet
protocols
Independentof platforms and
programming languages. 54
Service Orchestration
Requires metadata to describe:
Characteristics of the services,
Data that drives them.
Protocols:
Services described by WSDL.
Communications protocols by SOAP.
Data and meta data by XML 55
A Few Key SOA Protocols
UDDI (Universal Description, Discovery, and
Integration:
Defines the publication and discovery of web service
implementations.
WSDL (Web Services Description Language):
XML-based language that defines Web Services.
SOAP(Service Oriented Architecture Protocol):
Using it the client) sends a request to a server.
LDAP (Lightweight Directory Access Protocol):
Protocol for querying and modifying directory services.
ETL (Extract, Transform, and Load):
A process of moving data from a legacy system and
loading it into a SOA application. 56 56
Using Web Services
57
OASIS Symposium 57
2006
Web Service definitions revisited
A more precise definition:
an application component that:
Communicates via open protocols (HTTP,
SMTP, etc.)
Processes XML messages framed using
SOAP
Describes its messages using XML Schema
Provides an endpoint description using
WSDL 58
Web Services Components
XML – eXtensible Markup Language – A uniform
data representation and exchange mechanism.
service.
The Web Service Model
The Web Services architecture is based
upon the interactions between three roles:
Service provider
Service registry
Service requestor
The interactions involve the:
Publish operations
Find operation
Bind operations. 61
The Web Service Model (cont)
The Web Services model follows the publish, find, and
bind paradigm.
Web Service
Registry
1. publish 2. find
An HTML example:
<html>
<body>
<h2>John Doe</h2>
<p>2 Backroads Lane<br>
New York<br>
045935435<br>
john.doe@gmail.com<br>
</p>
</body>
</html>
64
XML vs HTML
This will be displayed as:
John Doe
2 Backroads Lane
New York
045935435
John.doe@gmail.com
<?xml version=1.0?>
<contact>
<name>John Doe</name>
<address>2 Backroads Lane</address>
<country>New York</country>
<phone>045935435</phone>
<email>john.doe@gmail.com</email>
</contact>
In this case:
The information contained is being marked, but not for
displaying.
Readable by both human and machines.
66
UDDI
UDDI stands for Universal Description,
Discovery and Integration.
67
Overview of Working
UDDI Registry
WSDL
Document
68
Client Web Service Code
Service Architecture Organized by
Layers
Example Layers
Reasons for Layering Presentation
& workflow
1. Flexible composition.
Composed Services
2. Reuse.
3. Separation of Concerns. Basic Services
69
Service Types
SOA Management & Security
service mediation, routing, trust
enablement. ESB, Service Registry
facades )
ct
fra er
nt
In S
ie
t Cl Data centric and logic
r
S ma centric consistent services.
Highly reusable, stateless
servers
l
rta
ice te
Po
rv osi
s
Se mp
Foundation
Co
Service Blocks
rv ic
s
Core APIs
ice
Se a s
B
rra
Te re
G dia
a
eo
M
Sh
e
I/CAD
Business
Capabilities
70
ech
I/..
G/T
In
Serv r
i the
SOA Vision
Have a marketplace for services:
It will automatically improve quality and
reduce prices.
To build an application:
Use off-the-shelf services and possibly
build some.
Cost of building reduces;
Also cost of ownership (which is quite
large for regular software) reduces. 71
Great Promise of SOA
The cost of creating the n-th
application is near-zero:
All
of the software services
required would already exists.
Onlyorchestration required to
produce a new application.
72
Why SOA Saves Code
Provides a standard way of interacting
with software.
Enables software to become building
blocks for reuse.
Shifts focus to application assembly
rather than design and coding.
Creates new applications out of existing
components.
Integrates with applications in other
enterprises. 73 73
SOA Benefits
SOA allows to align IT with mission of the organization
Better agility, no redundancy, system interactions, and reduces overall costs of system
maintenance
77
78
79
80
Commercial Cloud Players
81
82
A Data Center
83
84
Microsoft’s Data Center
85
Cloud Service Models
Software as a Platform as a Infrastructure as
Service (SaaS) Service (PaaS) a Service (IaaS)
SalesForce
CRM
LotusLive
Google
App
Engine
86
Key Technology: Virtualization
Hardware Hardware
89
Present Challenge
Owning software is very expensive:
A Rs. 50 Lakh software running on a Rs. 1 Lakh
computer is common place.
As with hardware, owning software is the
business tradition:
Both traditionally viewed as products --- bought
and used.
However, most of IT budget now goes in
supporting the hardware and software assets.
90
Background
To have water supply at home:
Do you install system to pump water from
river directly to your home?
To get electricity supply:
Do you install a thermal or hydro electric
generator?
It would lead to wastage:
You do not need to have all the water pipes
open all the time.
Unnecessarily expensive proposition. 91
Background
cont…
Should you own Rational Suite paying
Rs. 50 Lakhs:
If you use it only 10 hours every month
One hour of usage costs Rs. 100/-
Alsofrees user from maintenance and
data storage costs --- Given that
maintenance is usually a severe
overhead. 92
SaaS
Also called Application Service
Provider (ASP) model.
Promotes use of software as a
service rather than a product.
ASP provides access to and
manages commercially available
application.
93
SaaS cont…
96
Company name
SaaS vs. SOA
SaaS is a software delivery model:
SOAis a software construction
model.
SaaS counters the concept of a
user as the owner:
Owner is a vendor who hosts the
software and charges per usage
units. 97
SaaS versus SOA
Despite significant differences:
Espouse closely related architectural models.
model.
Business Model
Shift "ownership" of the software:
From the customer to a service provider.
Shift responsibility for hardware and
software management:
From the customer to the provider
Reduce the cost of providing software
services:
Through specialization and economy of
scale.
Target the "long tail" of small customers
100
Current Business Model
101
Big Deal 2: The Long Tail
Dozens of markets of millions or
$ / Customer millions of markets of dozens?
Large Customers
Typical Customers
# of Customers
102
SaaS Business Model
103
SaaS Architecture…
Client 1
Application
Meta-Model Instance Client 2
Play/Edit
Player
Client n
Edit
Data Designer
104
Factors Driving Adoption
Emergence of public clouds
Rapid deployment
Less upfront capital investment
Shifts to service providers :
continuousoperation, backups, updates
and infrastructure maintenance...
Reduces investing on an internal IT
team. 105
Factors Driving Adoption
cont…
Increased availability of the
Internet:
Improvements in security and
increased broadband availability.
Painful reminders of lengthy,
unsuccessful deployment cycles:
Makes buyers investigate simpler,
quicker alternatives. 106
Inhibitors
Concerns about:
Data security
Privacy of critical customer information.
Huge initial investment costs required
to create infrastructure:
Restricts new market entrants.
Constraints on adoption of simplified
efficient solutions. 107
Buyer Benefits
Low cost infrastructure and usage model
Rapid deployment
Simplified configuration & customization:
In traditional applications important functions
are front-loaded.
Vendor provides for reserve capacity to
handle usage spikes and outages.
Access from anywhere - ideal for
distributed workforce
Upgrades are regular and transparent. 108
Collaboration
109
Buyer Issues
Integration requirements with
existing applications.
Security of data.
Weakened IT management
control.
110
Service Provider Benefits
Steady recurring revenue.
Getting customers to buy incremental
functionality later is easier:
Can start with a simple application
Leveraging the "long tail”
You can rope in more smaller customers that
are unreachable at traditional
price/performance ratios.
Increased revenue leads to greater
investment and higher quality of software. 111
Service Provider Issues
For existing software houses:
Organizational implications of moving from a
product-centric to a service-centric delivery
model.
For start-ups:
Cash flow develops over time – building a
business is hard.
For both:
Strong incentive for adoption required – so
usability is key.
Reliability of hosted service is critical. 112
Conclusion: Value Comparison