Professional Documents
Culture Documents
Software Engineering
CSE320
CSE320 : CSE
Course details
• LTP – 3 0 0 [Three lectures/week]
• Text Book
FUNDAMENTALS OF SOFTWARE ENGINEERING by RAJIB
MALL, PHI (PRETICE HALL INDIA),
CSE320 : CSE
Course Assessment Model
• Marks break up*
• Attendance 5
• CA (3 online Assignments) 25
• MTT 20
• ETE 50
• Total 100
CSE320 : CSE
Detail of Academic Tasks
• AT1: Online Assigment1
• AT2: Online Assigment2
• AT3: Online Assigment3
CSE320 : CSE
MTT and ETT
• ETT:-- MCQs
CSE320 : CSE
Course Outcomes
• Plan and deliver an effective software engineering
process, based on knowledge of widely used
development life cycle models.
• Work effectively in a team to analyze the requirements
of a complex software system and solve problems by
creating appropriate designs that satisfies these
requirements.
• Translate a requirements specification into an
implementable design, following a structured and
organized process.
CSE320 : CSE
Course Outcomes
• Formulate a testing strategy for a software system,
employing test case design techniques such as
functional and structural testing.
CSE320 : CSE
The course contents
• Introduction to software engineering : Before MTE
Evolution and impact of software engineering, Software life cycle
models, Feasibility study, Functional and non-functional requirements,
Requirement gathering, Requirement analysis and specification
• Issues in software design : cohesion, coupling, DFDs
• Object modelling :
Object modelling using UML, Object oriented software
development, User interface design, Coding standards and code
review techniques
CSE320 : CSE
The course contents
• Testing : After MTE
Fundamentals of testing, White box and black box testing, Test coverage
analysis and test case design techniques, Mutation testing, Static and
dynamic analysis, Software reliability metrics, Reliability growth
modelling.
• Software project management :
Project management, Project planning and control, Cost
estimation, Project scheduling using PERT and GANTT
charts, Software Configuration Management
• Quality management :
Quality management, ISO and SEI CMMI, PSP and Six sigma,
Software Maintenance, reuse, CBSD, CASE, Advance topics
of Software Engineering.
CSE320 : CSE
The hitch…
The three BURNING questions in mind…
CSE320 : CSE
What is software?
CSE320 : CSE
Phases of Development
CSE320 : CSE
The Role of Software Engineering-1
A bridge from customer needs to programming implementation
Programmer
Customer
CSE320 : CSE
The Role of Software Engineering-2
Customer:
Requires a computer system to achieve some business goals
by user interaction or interaction with the environment
in a specified manner
System-to-be
Environment
Software-to-be
User
CSE320 : CSE
Example: ATM Machine
Understanding the money-machine problem:
1
7
4
0
2
5 3
8 6
9
Communication link
Bank’s
remote
ATM machine
datacenter
Bank
customer
CSE320 : CSE
How ATM Machine Might Work
Domain model Domain Model
created with help of
domain expert
Transaction
How may I record
help you? Cash
Bookkeeper
Speakerphone Safe
Safe keeper
Phone
Window clerk
Datacenter
liaison
Dispenser
Bank’s
remote
datacenter
CSE320 : CSE Customer
Cartoon Strip: How ATM Machine Works?
CSE320 : CSE
Software Engineering Blueprints
CSE320 : CSE
Second Law of Software Engineering
• Software should be written for people first
• ( Computers run software, but hardware quickly becomes outdated )
CSE320 : CSE
Software Development Methods
CSE320 : CSE
Software Development Methodologies
CSE320 : CSE
Waterfall Method
Unidirectional, no way back finish this step before moving to the next
CSE320 : CSE
Software myths
1. “If we get behind schedule, we can just add more people”
❑Fact: Adding people to a late project makes it even later.
❑Someone has to teach the new people.
2. “A general statement of objectives is enough to start programming”.
❑Fact: Incomplete requirements are a major cause for project failures.
3. “Changes in requirements are easy to deal with because software is
flexible”.
❑Fact: Changes are hard and expensive.
❑Especially during coding and after software deployment.
CSE320 : CSE
Software myths
CSE320 : CSE
Software crises
CSE320 : CSE
What are the attributes of good software?
The software should deliver the required functionality and
performance to the user and should be maintainable,
dependable and usable
• Maintainability
• Software must evolve to meet changing needs
• Dependability
• Software must be trustworthy
• Efficiency
• Software should not make wasteful use of system resources
• Usability
• Software must be usable by the users for which it was designed
CSE320 : CSE
Next Class: Software Life Cycle Models
www.lpu.in
•CSE320 : CSE
SOFTWARE
ENGINEERING
1
What is Software Engineering?
2
Programs versus Software
Products
3
Software Complexity
4
Principle of Abstraction
5
Hierarchy of Abstraction
6
Decomposition
• In this technique,
a complex problem
is divided in
several small
problems and then
small problems are
solved one by one.
7
Software Crisis
• Software products:
−fail to meet user requirements.
−frequently crash.
−expensive.
−difficult to alter, debug, and
enhance.
−often delivered late.
−use resources non-optimally.
8
Factors contributing to the
software crisis
• Larger problems,
• Lack of adequate training in
software engineering,
• Increasing skill shortage,
• Low productivity improvements.
9
Evolution of Technology
with Time
10
Evolution of Other Software
Engineering Techniques
14
Differences between the exploratory
style and modern software
development practices (CONT.)
• In exploratory style,
−errors are detected only during
testing,
• Now,
− focus is on detecting as many
errors as possible in each
phase of development.
15
Differences between the exploratory
style and modern software
development practices (CONT.)
• During all stages of
development process:
−Periodic reviews are being carried
out
• Software testing has become
systematic:
−standard testing techniques are
available.
16
Differences between the exploratory
style and modern software
development practices (CONT.)
17
EMERGENCE OF
SOFTWARE ENGINEERING
18
Control Flow-based Design
• Flow Charting
Technique:
− to write cost-
effective and correct
programs.
− to represent and
design algorithms.
− easier to develop
and understand.
19
Example: Control Flow-
based Design
21
Data Flow-oriented Design
22
Example: Data Flow-oriented
Design
23
Object-Oriented Design (80s)
• Object-oriented technique:
−natural objects (such as employees,
pay-roll-register, etc.) occurring in
a problem are first identified.
• Relationships among objects:
−such as composition, reference,
and inheritance are determined.
24
Life Cycle Model
• A software life cycle model (or
process model):
− a descriptive and diagrammatic model
of software life cycle:
− identifies all the activities required for
product development,
− establishes a precedence ordering among
the different activities,
− Divides life cycle into phases.
25
SDLC
26
SDLC Phases
27
Why Model Life Cycle ?
• A written description:
− forms a common understanding of
activities among the software
developers.
− helps in identifying inconsistencies,
redundancies in the development
process.
28
Life Cycle Model (CONT.)
29
Life Cycle Model (CONT.)
30
Life Cycle Model (CONT.)
31
Life Cycle Model (CONT.)
32
Life Cycle Model (CONT.)
33
Life Cycle Model (CONT.)
1
CLASSICAL
WATERFALL MODEL
2
Classical Waterfall Model
• Classical waterfall model divides
life cycle into phases:
− feasibility study,
− requirements analysis and
specification,
− design,
− coding and unit testing,
− integration and system testing,
− maintenance.
3
Classical Waterfall Model
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
4
Classical Waterfall Model
(CONT.)
5
Why to study Waterfall
Model?
6
Classical Waterfall Model
(CONT.)
7
Feasibility Study
• Main aim of feasibility study:determine whether
developing the product
− financially worthwhile
− technically feasible.
• First roughly understand what the customer
wants:
− different data which would be input to the system,
− processing needed on these data,
− output data to be produced by the system,
− various constraints on the behavior of the system.
8
Activities during Feasibility
Study
• Work out an overall understanding
of the problem.
• Formulate different solution
strategies.
• Examine alternate solution
strategies in terms of:
resources required,
cost of development, and
development time.
9
Activities during Feasibility
Study
• Perform a cost/benefit analysis:
− to determine which solution is the
best.
− you may determine that none of
the solutions is feasible due to:
high cost,
resource constraints,
technical reasons.
10
Requirements Analysis and
Specification
• Aim of this phase:
− understand the exact
requirements of the customer,
− document them properly.
• Consists of two distinct
activities:
− requirements gathering and
analysis
− requirements specification. 11
Goals of Requirements
Analysis
• Collect all related data from the
customer:
− analyze the collected data to
clearly understand what the
customer wants,
− find out any inconsistencies and
incompleteness in the
requirements,
− resolve all inconsistencies and
incompleteness. 12
Requirements Gathering
15
Requirements Analysis (CONT.)
• Engineers doing
requirements analysis and
specification:
−are designated as analysts.
16
Requirements Specification
• Organizing requirement
analysis into SRS
• Important content of document
− Functional Requirements
− Non - Functional Requirements
− The goal of implementation
17
Design
• Design phase transforms
requirements specification:
− into a form suitable for
implementation in some
programming language.
18
Design
• In technical terms:
− during design phase, software
architecture is derived from the
SRS document.
• Two design approaches:
− traditional approach,
− object oriented approach.
19
Traditional Design Approach
20
Structured Analysis
Activity
• Identify all the functions to be
performed.
• Identify data flow among the
functions.
• Decompose each function
recursively into sub-functions.
− Identify data flow among the
subfunctions as well.
21
Structure Analysis (cont.)
22
Structured Analysis (CONT.)
24
Object Oriented Design
26
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.
27
Implementation
• Purpose of implementation
phase (coding phase):
−translate software design into
source code.
28
Implementation
30
Integration and System
Testing
• Different modules are integrated in
a planned manner:
− modules are almost never integrated
in one shot.
− Normally integration is carried out
through a number of steps.
• During each integration step,
− the partially integrated system is
tested.
31
Integration and System
Testing
M1 M2
M3 M4
32
System Testing
• Corrective maintenance:
− Correct errors which were not discovered
during the product development phases.
• Perfective maintenance:
− Improve implementation of the system
− enhance functionalities of the system.
• Adaptive maintenance:
− Port software to a new environment,
e.g. to a new computer or to a new operating system.
35
Drawbacks of classical
water fall model
• 1. no feedback paths
• 2. difficult to accommodate changes
• 3. No overlapping of phases
• 4. Limited customer interactions
36
Question
37
Iterative Waterfall Model
• Classical waterfall model is
idealistic:
− assumes that no defect is
introduced during any
development activity.
− in practice:
defects do get introduced in almost
every phase of the life cycle.
38
Iterative Waterfall Model
(CONT.)
39
Iterative Waterfall Model
(CONT.)
40
Iterative Waterfall Model
(CONT.)
Feasibility Study
Req. Analysis
Design
Coding
Testing
Maintenance
41
Iterative Waterfall Model
(CONT.)
43
NEXT CLASS :
PROTOTYPING MODEL
44
FEASIBILITY
STUDY
1
Feasibility Study
2
Types of Feasibility Study
Economic Feasibility
Technical Feasibility
Behavioral Feasibility
3
Economic Feasibility
4
Technical Feasibility
5
Behavioural Feasibility
7
Steps in Feasibility Analysis(cont.)
8
Question
A feasibility study:
9
Requirements Analysis and
Specification
Many projects fail:
because they start implementing
the system without determining
whether they are building what
the customer really wants.
10
Requirements Analysis and
Specification
Goals of requirements analysis and
specification phase:
fully understand the user requirements
remove inconsistencies, anomalies,
etc. from requirements
document requirements properly in an
SRS document
11
Requirements Analysis and
Specification
Consists of two distinct
activities:
Requirements Gathering and
Analysis
Specification
12
Requirements Analysis and
Specification
The person who undertakes
requirements analysis and specification:
known as systems analyst:
collects data pertaining to the product
analyses collected data:
to understand what exactly needs to be
done.
writes the Software Requirements
Specification (SRS) document.
13
Requirements Analysis and
Specification
Final output of this phase:
Software Requirements
Specification (SRS) Document.
The SRS document is reviewed
by the customer.
reviewed SRS document forms the
basis of all future development
activities.
14
Requirements Gathering
17
Question
18
Analysis of the Gathered
Requirements
21
Analysis of the Gathered
Requirements (CONT.)
22
Analysis of the Gathered
Requirements (CONT.)
23
Analysis of the Gathered
Requirements (CONT.)
24
Software Requirements Specification
1
It should be concise
and at the same time should not be ambiguous.
It should specify what the system must do
and not say how to do it.
Easy to change.,
i.e. it should be well-structured.
It should be consistent.
It should be complete.
Properties of a good SRS document
(cont...)
10
It should be traceable
you should be able to trace which part of the
specification corresponds to which part of the
design and code, etc and vice versa.
It should be verifiable
SRS Document (CONT.)
11
Hardware to be used,
Operating system
or DBMS to be used
Unstructured Specifications:
Narrative essay --- one of the worst types of specification
document:
Difficult to change,
difficult to be precise,
difficult to be unambiguous,
4. Appendices
24
Thank you
Evolutionary Model
Evolutionary Model
Evolutionary model:
◦ The system is broken down into several modules which
can be incrementally implemented and delivered.
First develop the core modules of the system.
The initial product skeleton is refined into
increasing levels of capability:
◦ by adding new functionalities in successive versions.
2
Evolutionary Model (CONT.)
3
Evolutionary Model (CONT.)
A A A
B B
4
Version n
Design
Code Final
Test software
Version n-1 Deploy
Requirement
Specification Design
Version 2 Code
Test
Deploy
Version 1
Design
Code
Test
Deploy
Advantages of Evolutionary Model
6
Disadvantages of Evolutionary
Model
Often, difficult to subdivide problems into
functional units:
◦which can be incrementally implemented and
delivered.
◦evolutionary model is useful for very large problems,
◦ where it is easier to find modules for incremental
implementation.
7
Question
Evolutionary Model are:
A) Iterative
B) Non Linear
C) Non Repetitive
D) Discontinues
Evolutionary Model with Iteration
9
Evolutionary Model with iteration
Several advantages:
◦ Training can start on an earlier release
◦ customer feedback taken into account
◦ Markets can be created:
◦ for functionality that has never been offered.
◦ Frequent releases allow developers to fix unanticipated
problems quickly.
10
Spiral Model
Spiral Model
Proposed by Boehm in 1988.
Each loop of the spiral represents a phase of the software
process:
◦ the innermost loop might be concerned with system feasibility,
◦ the next loop with system requirements definition,
◦ the next one with system design, and so on.
There are no fixed phases in this model, the phases shown in the
figure are just examples.
12
Spiral Model (CONT.)
13
Spiral Model (CONT.)
Review and
plan for next Develop Next
phase Level of Product
14
Objective Setting (First Quadrant)
15
Risk Assessment and Reduction (Second
Quadrant)
For each identified project risk,
◦ a detailed analysis is carried out.
Steps are taken to reduce the risk.
For example, if there is a risk that the requirements are
inappropriate:
◦ a prototype system may be developed.
16
Spiral Model (CONT.)
17
Spiral Model as a meta model
Subsumes all discussed models:
◦ a single loop spiral represents waterfall model.
◦ uses an evolutionary approach --
◦ iterations through the spiral are evolutionary levels.
◦ enables understanding and reacting to risks during each
iteration along the spiral.
◦ uses:
◦ prototyping as a risk reduction mechanism
◦ retains the step-wise approach of the waterfall model.
18
Question
Which is the most important feature of spiral model?
A) Quality Management
B) Risk Management
C) Performance Management
D) Efficiency Management
Comparison of Different Life Cycle Models
Iterative waterfall model
◦ most widely used model.
◦ But, suitable only for well-understood problems.
Prototype model is suitable for projects not well understood:
◦ user requirements
20
Comparison of Different Life Cycle Models
(CONT.)
21
Prototyping Model
Prototyping 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,
◦inefficient performance.
2
Prototyping Model (CONT.)
5
Prototyping Model (CONT.)
Build Prototype
Implement
Refine
Requirements
Test
Maintenance
6
Prototyping Model (CONT.)
1
Introduction
Function-oriented design
techniques are very popular:
currently in use in many software
development organizations.
Function-oriented design
techniques:
start with the functional requirements
specified in the SRS document.
2
Question
3
Introduction
During the design process:
high-level functions are
successively decomposed:
into more detailed functions.
finally the detailed functions are
mapped to a module structure.
4
Introduction
Successive decomposition of
high-level functions:
into more detailed functions.
Technically known as top-
down decomposition.
5
Introduction
SA/SD methodology:
has essential features of several
important function-oriented
design methodologies ---
if you need to use any specific
design methodology later on,
you can do so easily with small
additional effort.
6
SA/SD (Structured
Analysis/Structured Design)
7
SA/SD (Structured
Analysis/Structured Design)
10
Structured analysis
Transforms a textual
problem description into a
graphic model.
done using data flow
diagrams (DFDs).
DFDs graphically represent
the results of structured
analysis.
11
Structured design
All the functions represented in
the DFD:
mapped to a module structure.
The module structure:
also called as the software
architecture:
12
Detailed Design
Software architecture:
refined through detailed
design.
Detailed design can be
directly implemented:
using a conventional
programming language.
13
Question
14
Structured Analysis vs.
Structured Design
Purpose of structured analysis:
capture the detailed structure of
the system as the user views it.
Purpose of structured design:
arrive at a form that is suitable
for implementation in some
programming language.
15
Structured Analysis vs.
Structured Design
The results of structured analysis can be
easily understood even by ordinary
customers:
does not require computer knowledge
directly represents customer’s perception of
the problem
uses customer’s terminology for naming
different functions and data.
The results of structured analysis can be
reviewed by customers:
to check whether it captures all their
requirements.
16
Structured Analysis
Based on principles of:
Top-down decomposition approach.
Divide and conquer principle:
each function is considered individually
(i.e. isolated from other functions)
decompose functions totally disregarding
what happens in other functions.
Graphical representation of results
using
data flow diagrams (or bubble charts).
17
Data flow diagrams
DFD is an elegant modelling
technique:
useful not only to represent the results
of structured analysis
applicable to other areas also:
e.g. for showing the flow of documents or
items in an organization,
DFD technique is very popular
because
it is simple to understand and use.
18
Data flow diagram
DFD is a hierarchical
graphical model:
shows the different functions
(or processes) of the system
and
data interchange among the
processes.
19
DFD Concepts
It is useful to consider each
function as a processing
station:
each function consumes some
input data and
produces some output data.
20
Data Flow Model of a Car
Assembly Unit
Engine Store Door Store
21
Data Flow Diagrams (DFDs)
A DFD model:
uses limited types of symbols.
simple set of rules
easy to understand:
it is a hierarchical model.
22
Hierarchical model
23
Hierarchical Model
24
Data Flow Diagrams (DFDs)
25
External Entity Symbol
Represented by a rectangle
External entities are real Librarian
physical entities:
input data to the system or
consume data produced by the
system.
Sometimes external entities are
called terminator, source, or sink.
26
Function Symbol
A function such as “search-book” is
represented using a circle: search-
This symbol is called a book
process or bubble or transform.
Bubbles are annotated with
corresponding function names.
Functions represent some activity:
function names should be verbs.
27
Data Flow Symbol
28
Data Store Symbol
Represents a logical file:
A logical file can be:
a data structure
a physical file on disk.
Each data store is connected
to a process:
by means of a data flow
symbol.
book-details
29
Data Store Symbol
Direction of data flow arrow:
shows whether data is being read
from or written into it.
find-book
An arrow into or out of a data
store: Books
31
Synchronous operation
32
Asynchronous operation
If two bubbles are connected via a
data store:
they are not synchronous.
Read- Validate-
numbers numbers
0.1 0.2
numbers Valid
Data- number
items
33
Question
34
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
data items.
For example, a data dictionary entry may
be:
grossPay = regularPay+overtimePay
35
Importance of Data
Dictionary
Provides all engineers in a project
with standard terminology for all
data:
A consistent vocabulary for data is
very important
different engineers tend to use
different terms to refer to the same
data,
causes unnecessary confusion.
36
Importance of Data
Dictionary
Data dictionary provides the
definition of different data:
in terms of their component elements.
For large systems,
the data dictionary grows rapidly in
size and complexity.
Typical projects can have thousands of
data dictionary entries.
It is extremely difficult to maintain
such a dictionary manually.
37
Data Dictionary
CASE (Computer Aided
Software Engineering) tools
come handy:
CASE tools capture the data
items appearing in a DFD
automatically to generate the
data dictionary.
38
Data Dictionary
CASE tools support queries:
about definition and usage of data items.
For example, queries may be made to
find:
which data item affects which processes,
a process affects which data items,
the definition and usage of specific data
items, etc.
Query handling is facilitated:
if data dictionary is stored in a relational
database management system (RDBMS).
39
Data Definition
Composite data are defined in terms of
primitive data items using following
operators:
+: denotes composition of data items,
e.g
a+b represents data a and b.
[,,,]: represents selection,
i.e. any one of the data items listed inside the
square bracket can occur.
For example, [a,b] represents either a occurs
or b occurs.
40
Data Definition
( ): contents inside the bracket
represent optional data
which may or may not appear.
a+(b) represents either a or a+b
occurs.
{}: represents iterative data
definition,
e.g. {name}5 represents five name
data.
41
Data Definition
{name}* represents
zero or more instances of name data.
= represents equivalence,
e.g. a=b+c means that a represents b
and c.
* *: Anything appearing within *
* is considered as comment.
42
Data dictionary for RMS
Software
numbers=valid-numbers=a+b+c
a:integer * input number *
b:integer * input number *
c:integer * input number *
asq:integer
bsq:integer
csq:integer
squared-sum: integer
Result=[RMS,error]
RMS: integer * root mean square value*
error:string * error message*
43
Data dictionary for RMS
Software
a 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
44
Question
45
How is Structured Analysis
Performed?
Initially represent the software
at the most abstract level:
called the context diagram.
the entire system is represented
as a single bubble,
this bubble is labelled according
to the main function of the
system.
46
Tic-tac-toe: Context
Diagram
Tic-tac-toe
display software
move
Human Player
47
Context Diagram
A context diagram shows:
data input to the system,
output data generated by
the system,
external entities.
The context diagram is also
called as the level 0 DFD.
48
Context Diagram
Context diagram
establishes the context of the
system, i.e.
represents:
Data sources
Data sinks.
49
Level 1 DFD
Examine the SRS document:
Represent each high-level
function as a bubble.
Represent data input to every
high-level function.
Represent data output from every
high-level function.
50
Level 1 DFD
Display- game
board
move 0.1 result
Validate- Check-
move board winner
0.2 0.4
Play-
move
0.3
51
Higher level DFDs
Each high-level function is
separately decomposed into
subfunctions:
identify the subfunctions of the
function
identify the data input to each
subfunction
identify the data output from each
subfunction
These are represented as DFDs.
52
Decomposition
Decomposition of a bubble:
also called factoring or
exploding.
Each bubble is decomposed
to
between 3 to 7 bubbles.
53
Decomposition
54
Decomposition
55
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.
56
Question
57
Balancing a DFD
Data flowing into or out of a bubble:
must match the data flows at the next level
of DFD.
This is known as balancing a DFD
In the level 1 of the DFD,
data item c flows into the bubble P3 and the
data item d and e flow out.
In the next level, bubble P3 is
decomposed.
The decomposition is balanced as data item c
flows into the level 2 diagram and d and e
flow out. 58
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.
The bubble at context level:
assigned number 0.
Bubbles at level 1:
numbered 0.1, 0.2, 0.3, etc
When a bubble numbered x is
decomposed,
its children bubble are numbered x.1, x.2,
x.3, etc.
60
Example 1: RMS Calculating
Software
61
Example 1: RMS Calculating
Software
62
Example 1: RMS Calculating
Software
Data- Compute-
items RMS
0
User result
Context Diagram
63
Example 1: RMS Calculating
Software
64
Example 1: RMS Calculating
Software
65
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
66
Example 1: RMS Calculating
Software
Squared-
Calculate- sum Calculate-
squared-sum mean
0.3.1 0.3.2
Valid - Mean-
numbers square
Calculate-
root
0.3.3
RMS
67
Example: RMS Calculating
Software
b
a 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
68
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.
69
Example 2: Tic-Tac-Toe
Computer Game
A human player and the computer make
alternate moves on a 3 3 square.
A move consists of marking a previously
unmarked square.
The user inputs a number between 1
and 9 to mark a square
Whoever is first to place three
consecutive marks along a straight line
(i.e., along a row, column, or diagonal)
on the square wins.
70
Example: Tic-Tac-Toe
Computer Game
As soon as either of the human player or
the computer wins,
a message announcing 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.
71
Context Diagram for
Example
Tic-tac-toe
software
display 0
move
Human Player
72
Level 1 DFD
Display- game
board
move 0.1 result
Validate- Check-
move board winner
0.2 0.4
Play-
move
0.3
73
Data dictionary
Display=game + result
move = integer
board = {integer}9
game = {integer}9
result=string
74
Software Design
Introduction
Design phase transforms SRS
document:
into a form easily implementable in
some programming language.
d1 d2
d3 d1 d4
High-level design
Understandability of a design is a
major issue:
➢determines goodness of design:
➢a design that is easy to
understand: also easy to
maintain and change.
What Is Good Software
Design?
1. low fan-out
Fan-out: a measure of the number of
modules directly controlled by given
module.
2. abstraction
Cohesion and Coupling
temporal
logical
coincidental
Coincidental cohesion
search
display
Functional cohesion
data
stamp
control Degree of
coupling
common
content
Data coupling
Two modules are data coupled,
if they communicate by an
elementary data item that is
passed as a parameter between
the two, eg an integer, a floa,
character etc.
Stamp coupling
Two modules are stamp coupled,
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=2
Fan out=0
Goodness of Design
Function-oriented design
Object-oriented design
Function-Oriented
Design
A system is looked upon as something
that performs a set of functions.
Starting at this high-level view of the
system:
➢each function is successively refined into
more detailed functions.
Each subfunction:
In OOD:
➢software is not developed by
designing functions such as:
1. update-employee-record,
2. get-employee-address, etc.
High Cohesion
Functional
Sequential
Communicational
Procedural
Temporal
Logical
Coincidental
Low
Coincidental Cohesion
• Definition: Parts of the component are only
related by their location in source code
• Elements needed to achieve some
functionality are scattered throughout the
system.
• Accidental
• Worst form
Coincidental Cohesion(cont.)
Function: Function:
Issue-book Issue-book
Create-member Return-book
Compute-vendor-credit Query-book
Request-librarian-leave Find-borrower
Example of cohesion
Logical Cohesion
• Definition: Elements of component are
related logically and not functionally.
All elements of the module perform similar
operations:
e.g. error handling, data input, data output,
etc.
Function A
logic Function A’
Function A’’
Logical
Similar functions
Temporal Cohesion
• Definition: Elements of a component are
related by timing.
• The module contains tasks that are related
by the fact that all the tasks must be
executed in the same time span.
Time t0
Time t0 + X
Time t0 + 2X
Temporal
Related by time
Procedural Cohesion
• Definition: Set of functions of the module
are executed one after the other
If the set of functions of the module all part of a procedure
(algorithm) in which certain sequence of steps have to
be carried out in a certain order for achieving an
objective,
e.g. the algorithm for decoding a message.
For example: Login(), place-order(), check-order(), print-
bill() and logout()
Communicational Cohesion
Definition: If All functions of the module Refer to
the same data structure,
Example:
the set of functions defined on an array or a
stack.
admitStudent,
enterMarks studentRecords
printGradeSheet ARRAY
Sequential Cohesion
• The output of one component is the input to
another.
Sort
Search
Display
Functional Cohesion
• Definition: If the Different elements of a
module cooperate to achieve a single
function.
• Every element in the component is
essential to the computation.
Module-Name:
Managing-Book-Lending
Function:
Issue-book
Return-book
Query-book
Find-borrower
Examples of Cohesion-1
Function A
Function B
Function C
Procedural
Related by order of functions
Examples of Cohesion-2
Function A Function A
Function B Function B
Function C Function C
Communicational Sequential
Access same data Output of one is input to another
Function A part 1
Function A part 2
Function A part 3
Functional
Sequential with complete, related functions
Question
• Which of the following is the best type of
module cohesion?
a. Functional Cohesion
b. Temporal Cohesion
c. Logical Cohesion
d. Sequential Cohesion
Coupling: Degree of dependence
among components
High Coupling
Content
Common
Control
Loose
Stamp
Data
Uncoupled
Low
Question
• What is the typical relationship between
coupling and cohesion?
a. There is no relationship between coupling
and cohesion.
b. As cohesion increases, coupling
increases.
c. As cohesion increases, coupling
decreases.
Content coupling
Content coupling exists between two
modules:
if they share code,
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=2
Fan out=0
Goodness of Design
Function-oriented design
Object-oriented design
Function-Oriented Design
Each subfunction:
In OOD:
➢software is not developed by
designing functions such as:
1. update-employee-record,
2. get-employee-address, etc.
1
Introduction
Function-oriented design
techniques are very popular:
currently in use in many software
development organizations.
Function-oriented design
techniques:
start with the functional requirements
specified in the SRS document.
2
Question
3
Introduction
During the design process:
high-level functions are
successively decomposed:
into more detailed functions.
finally the detailed functions are
mapped to a module structure.
4
Introduction
Successive decomposition of
high-level functions:
into more detailed functions.
Technically known as top-
down decomposition.
5
Introduction
SA/SD methodology:
has essential features of several
important function-oriented
design methodologies ---
if you need to use any specific
design methodology later on,
you can do so easily with small
additional effort.
6
SA/SD (Structured
Analysis/Structured Design)
7
SA/SD (Structured
Analysis/Structured Design)
10
Structured analysis
Transforms a textual
problem description into a
graphic model.
done using data flow
diagrams (DFDs).
DFDs graphically represent
the results of structured
analysis.
11
Structured design
All the functions represented in
the DFD:
mapped to a module structure.
The module structure:
also called as the software
architecture:
12
Detailed Design
Software architecture:
refined through detailed
design.
Detailed design can be
directly implemented:
using a conventional
programming language.
13
Question
14
Structured Analysis vs.
Structured Design
Purpose of structured analysis:
capture the detailed structure of
the system as the user views it.
Purpose of structured design:
arrive at a form that is suitable
for implementation in some
programming language.
15
Structured Analysis vs.
Structured Design
The results of structured analysis can be
easily understood even by ordinary
customers:
does not require computer knowledge
directly represents customer’s perception of
the problem
uses customer’s terminology for naming
different functions and data.
The results of structured analysis can be
reviewed by customers:
to check whether it captures all their
requirements.
16
Structured Analysis
Based on principles of:
Top-down decomposition approach.
Divide and conquer principle:
each function is considered individually
(i.e. isolated from other functions)
decompose functions totally disregarding
what happens in other functions.
Graphical representation of results
using
data flow diagrams (or bubble charts).
17
Data flow diagrams
DFD is an elegant modelling
technique:
useful not only to represent the results
of structured analysis
applicable to other areas also:
e.g. for showing the flow of documents or
items in an organization,
DFD technique is very popular
because
it is simple to understand and use.
18
Data flow diagram
DFD is a hierarchical
graphical model:
shows the different functions
(or processes) of the system
and
data interchange among the
processes.
19
DFD Concepts
It is useful to consider each
function as a processing
station:
each function consumes some
input data and
produces some output data.
20
Data Flow Model of a Car
Assembly Unit
Engine Store Door Store
21
Data Flow Diagrams (DFDs)
A DFD model:
uses limited types of symbols.
simple set of rules
easy to understand:
it is a hierarchical model.
22
Hierarchical model
23
Hierarchical Model
24
Data Flow Diagrams (DFDs)
25
External Entity Symbol
Represented by a rectangle
External entities are real Librarian
physical entities:
input data to the system or
consume data produced by the
system.
Sometimes external entities are
called terminator, source, or sink.
26
Function Symbol
A function such as “search-book” is
represented using a circle: search-
This symbol is called a book
process or bubble or transform.
Bubbles are annotated with
corresponding function names.
Functions represent some activity:
function names should be verbs.
27
Data Flow Symbol
28
Data Store Symbol
Represents a logical file:
A logical file can be:
a data structure
a physical file on disk.
Each data store is connected
to a process:
by means of a data flow
symbol.
book-details
29
Data Store Symbol
Direction of data flow arrow:
shows whether data is being read
from or written into it.
find-book
An arrow into or out of a data
store: Books
31
Synchronous operation
32
Asynchronous operation
If two bubbles are connected via a
data store:
they are not synchronous.
Read- Validate-
numbers numbers
0.1 0.2
numbers Valid
Data- number
items
33
Question
34
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
data items.
For example, a data dictionary entry may
be:
grossPay = regularPay+overtimePay
35
Importance of Data
Dictionary
Provides all engineers in a project
with standard terminology for all
data:
A consistent vocabulary for data is
very important
different engineers tend to use
different terms to refer to the same
data,
causes unnecessary confusion.
36
Importance of Data
Dictionary
Data dictionary provides the
definition of different data:
in terms of their component elements.
For large systems,
the data dictionary grows rapidly in
size and complexity.
Typical projects can have thousands of
data dictionary entries.
It is extremely difficult to maintain
such a dictionary manually.
37
Data Dictionary
CASE (Computer Aided
Software Engineering) tools
come handy:
CASE tools capture the data
items appearing in a DFD
automatically to generate the
data dictionary.
38
Data Dictionary
CASE tools support queries:
about definition and usage of data items.
For example, queries may be made to
find:
which data item affects which processes,
a process affects which data items,
the definition and usage of specific data
items, etc.
Query handling is facilitated:
if data dictionary is stored in a relational
database management system (RDBMS).
39
Data Definition
Composite data are defined in terms of
primitive data items using following
operators:
+: denotes composition of data items,
e.g
a+b represents data a and b.
[,,,]: represents selection,
i.e. any one of the data items listed inside the
square bracket can occur.
For example, [a,b] represents either a occurs
or b occurs.
40
Data Definition
( ): contents inside the bracket
represent optional data
which may or may not appear.
a+(b) represents either a or a+b
occurs.
{}: represents iterative data
definition,
e.g. {name}5 represents five name
data.
41
Data Definition
{name}* represents
zero or more instances of name data.
= represents equivalence,
e.g. a=b+c means that a represents b
and c.
* *: Anything appearing within *
* is considered as comment.
42
Data dictionary for RMS
Software
numbers=valid-numbers=a+b+c
a:integer * input number *
b:integer * input number *
c:integer * input number *
asq:integer
bsq:integer
csq:integer
squared-sum: integer
Result=[RMS,error]
RMS: integer * root mean square value*
error:string * error message*
43
Data dictionary for RMS
Software
a 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
44
Question
45
How is Structured Analysis
Performed?
Initially represent the software
at the most abstract level:
called the context diagram.
the entire system is represented
as a single bubble,
this bubble is labelled according
to the main function of the
system.
46
Tic-tac-toe: Context
Diagram
Tic-tac-toe
display software
move
Human Player
47
Context Diagram
A context diagram shows:
data input to the system,
output data generated by
the system,
external entities.
The context diagram is also
called as the level 0 DFD.
48
Context Diagram
Context diagram
establishes the context of the
system, i.e.
represents:
Data sources
Data sinks.
49
Level 1 DFD
Examine the SRS document:
Represent each high-level
function as a bubble.
Represent data input to every
high-level function.
Represent data output from every
high-level function.
50
Level 1 DFD
Display- game
board
move 0.1 result
Validate- Check-
move board winner
0.2 0.4
Play-
move
0.3
51
Higher level DFDs
Each high-level function is
separately decomposed into
subfunctions:
identify the subfunctions of the
function
identify the data input to each
subfunction
identify the data output from each
subfunction
These are represented as DFDs.
52
Decomposition
Decomposition of a bubble:
also called factoring or
exploding.
Each bubble is decomposed
to
between 3 to 7 bubbles.
53
Decomposition
54
Decomposition
55
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.
56
Question
57
Balancing a DFD
Data flowing into or out of a bubble:
must match the data flows at the next level
of DFD.
This is known as balancing a DFD
In the level 1 of the DFD,
data item c flows into the bubble P3 and the
data item d and e flow out.
In the next level, bubble P3 is
decomposed.
The decomposition is balanced as data item c
flows into the level 2 diagram and d and e
flow out. 58
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.
The bubble at context level:
assigned number 0.
Bubbles at level 1:
numbered 0.1, 0.2, 0.3, etc
When a bubble numbered x is
decomposed,
its children bubble are numbered x.1, x.2,
x.3, etc.
60
Example 1: RMS Calculating
Software
61
Example 1: RMS Calculating
Software
62
Example 1: RMS Calculating
Software
Data- Compute-
items RMS
0
User result
Context Diagram
63
Example 1: RMS Calculating
Software
64
Example 1: RMS Calculating
Software
65
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
66
Example 1: RMS Calculating
Software
Squared-
Calculate- sum Calculate-
squared-sum mean
0.3.1 0.3.2
Valid - Mean-
numbers square
Calculate-
root
0.3.3
RMS
67
Example: RMS Calculating
Software
b
a 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
68
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.
69
Example 2: Tic-Tac-Toe
Computer Game
A human player and the computer make
alternate moves on a 3 3 square.
A move consists of marking a previously
unmarked square.
The user inputs a number between 1
and 9 to mark a square
Whoever is first to place three
consecutive marks along a straight line
(i.e., along a row, column, or diagonal)
on the square wins.
70
Example: Tic-Tac-Toe
Computer Game
As soon as either of the human player or
the computer wins,
a message announcing 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.
71
Context Diagram for
Example
Tic-tac-toe
software
display 0
move
Human Player
72
Level 1 DFD
Display- game
board
move 0.1 result
Validate- Check-
move board winner
0.2 0.4
Play-
move
0.3
73
Data dictionary
Display=game + result
move = integer
board = {integer}9
game = {integer}9
result=string
74
Software engineering
USER INTERFACE
DESIGN
Characteristics of a user
interface
Speed of learning.
Speed of use
Speed of recall.
Error prevention
Attractiveness.
Consistency.
Feedback.
Error recovery (undo facility).
User guidance and on-line help.
BASIC CONCEPTS:
Mode-based interface vs. modeless
interface
Graphical
User
Interface
A GUI usually supports command
selection using an attractive and user-
friendly menu selection system.
In a GUI, a pointing device such as a
mouse or a light pen can be used for
issuing commands. The use of a
pointing device increases the efficacy
issue procedure.
Some advantages about
TBUI
• In this approach, development is organized into a series of short, fixed-length (for example, four
week) mini-projects called iterations.
• Each iteration includes its own requirements analysis, design, implementation, and testing activities.
ITERATIVE AND INCREMENTAL
DEVELOPMENT
• The system grows incrementally over time, iteration by iteration, and thus this approach is also
known as iterative and incremental development.
BENEFITS OF ITERATIVE DEVELOPMENT
It includes:
• early rather than late mitigation of high risks (technical, requirements, objectives, usability, and
so forth)
• early visible progress
• early feedback, user engagement, and adaptation, leading to a refined system that more closely
meets the real needs of the stakeholders
• managed complexity; the team is not overwhelmed by "analysis paralysis" or very long and
complex steps
• the learning within an iteration can be methodically used to improve the development process
itself, iteration by iteration
ITERATION LENGTH
• The UP (and experienced iterative developers) recommends an iteration length between two
and six weeks.
• Much less than two weeks, and it is difficult to complete sufficient work to get meaningful
throughput and feedback;
• Much more than six or eight weeks, and the complexity becomes rather overwhelming, and
feedback is delayed.
• Short is good.
THE UP PHASES
The unified process involves iterating over the following four phases as following:
1.Inception— During the phase, the scope of the project is defined and Prototype may be
developed to form a clear idea of the project .
2.Elaboration—In this phase, the functional and non functional requirements are captured.
3.Construction- During this phase analysis, design, and implementation activity is carried out. Full
text description of use case are written during the construction phase and each use case is taken up
for the start of new iteration.
4.Transition—Produces beta-release system. During this phase the product is installed in the user’s
environment and maintained.
QUESTION
1
Object-oriented Concepts
Basic Mechanisms:
Objects:
A real-world entity.
A system is designed as a set of
interacting objects.
Consists of data (attributes) and
functions (methods) that operate on data
Hides organization of internal information
(Data abstraction)
Examples: an employee, a book etc.
2
Object-oriented Concepts
m8 m7
mi are methods
of the object
m1 m6
Data
m2 m5
Object
m3 m4
Model of an object
3
Object-oriented Concepts
Class:
Instances are objects
Template for object creation
Examples: set of all employees, different
types of book
4
Object-oriented Concepts
Methods and message:
Operations supported by an object
Means for manipulating the data of
other objects
Invoked by sending message
Examples: calculate_salary, issue-
book, member_details, etc.
5
Object-oriented Concepts
Inheritance:
Allows to define a new class (derived
class) by extending or modifying existing
class (base class)
Represents Generalization-
specialization relationship
Allows redefinition of the existing
methods (method overriding)
6
Object-oriented Concepts
Multiple Inheritance:
Subclass can inherit attributes and
methods from more than one base class
7
Object-oriented Concepts
Derived
Faculty Students Staff Faculty Students Staff
Classes
8
Object-oriented Concepts
Key Concepts:
Abstraction:
Consider aspects relevant for certain
purpose
Suppress non-relevant aspects
Supported at two levels i.e. class level
where base class is an abstraction &
object level where object is a data
abstraction entity
9
Object-oriented Concepts
Advantages of abstraction:
Reduces complexity of software
Increases software productivity
It is shown that software
productivity is inversely proportional
to software complexity
10
Object-oriented Concepts
Encapsulation:
Objects communicate outside world
through messages
Objects data encapsulated within its
methods
11
Object-oriented Concepts
m4
m3
m5
m2 Data
m6
m1
Methods
Concept of encapsulation
12
Object-oriented Concepts
Polymorphism:
Denotes to poly (many) morphism
(forms)
Same method call result in different
actions by different objects (static
binding)
13
Object-oriented Concepts
Dynamic binding:
In inheritance hierarchy, an object can be
assigned to another object of its ancestor class
14
Object-oriented Concepts
Dynamic binding:
Exact method cannot be known at compile
time
15
Question
16
Advantages
of Object-oriented design
Code and design reuse
Increased productivity
Ease of testing & maintenance
Better understandability
Its agreed that increased
productivity is chief advantage
17
Advantages
of Object-oriented design
Initially incur higher costs, but
after completion of some projects
reduction in cost become possible
Well-established OO methodology
and environment can be managed
with 20-50% of traditional cost
of development
18
Object
modelling using UML
UML is a modelling language
Not a system design or
development methodology
Used to document object-
oriented analysis and design
Independent of any specific
design methodology
19
UML
Based Principally on
OMT [Rumbaugh 1991]
Booch’s methodology[Booch 1991]
OOSE [Jacobson 1992]
Odell’s methodology[Odell 1992]
Shlaer and Mellor [Shlaer 1992]
20
UML
OMT
UML
Booch
OOSE Methodology
21
Why UML is required?
22
UML diagrams
23
UML diagrams
Views of a system
User’s view
Structural view
Behavioral view
Implementation view
Environmental view
24
UML diagrams
Behavioural View
Structural View
- Sequence Diagram
- Class Diagram - Collaboration Diagram
- Object Diagram - State-chart Diagram
- Activity Diagram
User’s View
-Use Case
Diagram
NO
Use case model, class diagram and one
of the interaction diagram for a simple
system
State chart diagram in case of many
state changes
Deployment diagram in case of large
number of hardware components
26
Use Case model
27
Use Cases
28
Question
29
Use Cases
30
Example of
Use Cases
For library information system
issue-book
Query-book
Return-book
Create-member
Add-book, etc.
31
Representation of
Use Cases
Represented by use case diagram
Use case is represented by ellipse
System boundary is represented by
rectangle
Users are represented by stick
person icon (actor)
Communication relationship
between actor and use case by line
External system by stereotype
32
Example of Use Cases
Play Move
33
Why develop
Use Case diagram?
Serves as requirements specification
Users identification helps in
implementing security mechanism
through login system
Another use in preparing the
documents (e.g. user’s manual)
34
Factoring
Use Cases
Complex use cases need to be factored
into simpler use cases
Represent common behavior across
different use cases
Three ways of factoring
Generalization
Includes
Extends
35
Factoring Using
Generalization
36
Factoring Using Includes
<<include>> Common
Base use case
use case
<<include>>
<<include>>
<<include>> <<include>>
Paralleling model 37
Factoring Using Extends
38
Question
39
Class diagram
40
Class diagram
41
Example of
Class diagram
42
Association Relationship
1 borrowed by *
Library Member Book
43
Aggregation Relationship
Represent a whole-part relationship
Represented by diamond symbol at
the composite end
Cannot be reflexive(i.e. recursive)
Not symmetric
It can be transitive
44
Aggregation Relationship
1 * 1
Document Paragraph * Line
Representation of aggregation
45
Composition Relationship
1 *
Order Item
Representation of composition
46
Class Dependency
47
48
Object diagram
Mritunjay Mritunjay
B10028 B10028
C-108, Laksmikant Hall C-108, Laksmikant Hall
1119 1119
Mrituj@cse Mrituj@cse
25-02-04 25-02-04
25-03-06 25-03-06
NIL NIL
IssueBook( );
findPendingBooks( );
findOverdueBooks( );
returnBook( );
findMembershipDetails( );
49
Object diagram
50
Question
51
Interaction diagram
Models how groups of objects
collaborate to realize some behaviour
Typically each interaction diagram
realizes behaviour of a single use case
Two kinds: Sequence & Collaboration
These diagram play a very important
role in the design process
52
Sequence diagram
Shows interaction among objects as two-
dimensional chart
Objects are shown as boxes at top
If object created during execution then
shown at appropriate place
Objects existence are shown as
dashed lines (lifeline)
Objects activeness, shown as
rectangle on lifeline
53
Sequence diagram
54
Example of
Sequence diagram
:Library
:Library
:Library Book :Library
Book :Book
Boundary Renewal Member
Register
Controller
confirm
confirm
updateMemberBorrowing
56
Example of
Collaboration diagram
6: * find
:Library
Book :Book
[reserved] Register
9: update
8: apology 5: book 10: confirm
Selected
1: renewBook :Library [reserved]
:Library Book 7: apology
Boundary 3: display Renewal
Borrowing Controller
4: selectBooks
2: findMemberBorrowing
12: confirm
:Library
Member
updateMemberBorrowing
58
Activity diagram
Can represent parallel activity and
synchronization aspects
59
Activity diagram
Normally employed in business process
modelling
60
Example of
Activity diagram
Academic Section Accounts Section Hostel Office Hospital Department
check
student
records
receive
fees
allot create
hostel hospital
record
register
receive
in
fees
course
conduct
allot medical
room examination
issue
identity card
Activity diagram for student admission procedure at IIT
61
State Chart diagram
Based on the work of David Harel
[1990]
62
State Chart diagram
Elements of state chart diagram
Initial State: Filled circle
Final State: Filled circle inside larger
circle
State: Rectangle with rounded corners
Transitions: Arrow between states,
also boolean logic condition (guard)
63
Example of
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
65
Example 1: Tic-Tac-Toe
Computer Game
A human player and the computer make
alternate moves on a 3 3 square.
A move consists of marking a previously
unmarked square.
The user inputs a number between 1
and 9 to mark a square
Whoever is first to place three
consecutive marks along a straight line
(i.e., along a row, column, or diagonal)
on the square wins.
66
Example 1: Tic-Tac-Toe
Computer Game
As soon as either of the human player or
the computer wins,
a message announcing 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.
67
Example 1: Use Case Model
Play Move
68
Example 1: Sequence Diagram
:playMove :playMove
:board
Boundary Controller
acceptMove checkMoveValidity
move
[invalidMove] [invalidMove]
announceInvalidMove
announceInvalidMove
checkWinner
[game over]
[game over] announceResult
announceResult
playMove
checkWinner
displayBoardPositions getBoardPositions
Board PlayMoveBoundary
int position[9]
Controller
announceInvalidMove
announceResult
70
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
assigned a unique customer
number (CN) by the computer.
71
Example 2: Supermarket Prize
Scheme
A customer can present his CN to
the staff when he makes any
purchase.
The value of his purchase is
credited against his CN.
At the end of each year, the
supermarket awards surprise gifts
to ten customers who make highest
purchase.
72
Example 2: Supermarket Prize
Scheme
Also, it awards a 22 carat gold coin
to every customer whose purchases
exceed Rs. 10,000.
The entries against the CN are reset
on the last day of every year after
the prize winner’s lists are
generated.
73
Example 2: Use Case Model
register
Customer customer Clerk
register
sales
Sales Clerk
select
winners
Supermarket
Prize scheme
Manager
74
Example 2: Sequence Diagram for
the Select Winners Use Case
:SelectWinner :SelectWinner :Sales :Sales :Customer :Customer
Boundary Controller History Record Register Record
Select
SelectWinners
Winners
SelectWinners
*computeSales
*browse
register
register
checkDuplicate
*match
[duplicate]
showError
generateCIN
create
register :Customer
Record
displayCIN
:Register :Register
:Sales
Sales Sales
History
Boundary Controller
RegisterSales registerSales
registerSales
create :Sales
Record
confirm
confirm
77
Example 2: Sequence Diagram for
the Register Sales Use Case
:Register
:Sales
Sales
History
Boundary
registerSales
RegisterSales
create :Sales
Record
confirm
78
Example 1: Class Diagram
SalesHistory CustomerRegister
selectWinners findWinnerDetails
registerSales register
1 1
* *
SalesRecords CustomerRecord
salesDetails name
address
computerSales browse
browse checkDuplicate
create create
79
Summary
We discussed object-oriented
concepts
Basic mechanisms: Such as objects,
class, methods, inheritance etc.
Key concepts: Such as abstraction,
encapsulation, polymorphism,
composite objects etc.
80
Summary
We discussed an important OO language
UML
Its origin, as a standard, as a model
Use case representation, its factorisation
such as generalization, includes and extends
Different diagrams for UML representation
In class diagram we discussed some
relationships association, aggregation,
composition and inheritance
81
Summary
Some more diagrams such as
interaction diagrams (sequence and
collaboration), activity diagrams,
state chart diagram
We discussed OO software
development process and patterns
In this we discussed some patterns
example and domain modelling
82
Coding
At the end of the design phase we have:
module structure of the system
module specifications:
data structures and algorithms for each module.
Objective of coding phase:
transform design into code
unit test the code.
1
Coding Standards
Good software development
organizations require their
programmers to:
adhere some standard style of
coding
called coding standards.
2
Coding Standards
Many software development
organizations:
formulate their own coding
standards that suits them most,
require their engineers to follow
these standards.
3
Coding Standards
Advantage of adhering to a
standard style of coding:
it gives a uniform appearance to
the codes written by different
engineers,
it enhances code understanding,
encourages good programming
practices.
4
Coding Standards
A coding standard
sets out standard ways of
doing several things:
the way variables are named,
code is laid out,
maximum number of source
lines allowed per function, etc.
5
Question
6
Coding guidelines
Provide general suggestions
regarding coding style to be
followed.
7
Coding Standards and
Guidelines
Good organizations usually develop
their own coding standards and
guidelines:
depending on what best suits their
organization.
8
Representative Coding
Standards
Rules for limiting the use of global:
what types of data can be declared
global and what can not.
Naming conventions for
global variables,
local variables, and
constant identifiers.
9
Representative Coding
Standards
Contents of headers for different
modules:
The headers of different modules
should be standard for an
organization.
The exact format for header
information is usually specified.
10
Representative Coding
Standards
Header data:
Name of the module,
date on which the module was created,
author's name,
modification history,
synopsis of the module,
different functions supported, along with
their input/output parameters,
global variables accessed/modified by the
module.
11
Representative Coding
Standards
12
Representative Coding
Standards
Error return conventions and
exception handling mechanisms.
the way error and exception
conditions are handled should be
standard within an organization.
For example, when different functions
encounter error conditions
should either return a 0 or 1 consistently.
13
Representative Coding
Guidelines
15
Representative Coding
Guidelines
Code should be well-documented.
Rules of thumb:
on the average there must be at least
one comment line
for every three source lines.
The length of any function should not
exceed 10 source lines.
16
Representative Coding
Guidelines
Lengthy functions:
usually very difficult to
understand
probably do too many different
things.
17
Representative Coding
Guidelines
18
Code review
19
Code Walkthrough
An informal code analysis technique.
undertaken after the coding of a module is
complete.
A few members of the development team
select some test cases:
simulate execution of the code by hand using
these test cases.
Discussion should focus on discovery of
errors:
and not on how to fix the discovered errors.
20
Code Walkthrough
21
Code Inspection
In contrast to code walk through, the aim of code
inspection is to discover some common types of errors
caused due to oversight and improper programming.
In addition to the commonly made errors, adherence to
coding standards is also checked during code inspection.
Good software development companies collect statistics
regarding different types of errors commonly committed
by their engineers and identify the type of errors most
frequently committed.
Such a list of commonly committed errors can be used
during code inspection to look out for possible errors.
22
Commonly made errors
Use of uninitialized variables.
Nonterminating loops.
Array indices out of bounds.
Improper storage allocation and
deallocation.
Actual and formal parameter mismatch in
procedure calls.
Jumps into loops.
23
Question
24