Software Engg. 1-4
Software Engg. 1-4
2
3
4
5
Why Software Engineering ?
6
The Evolving Role of Software
7
The Evolving Role of Software
8
The Evolving Role of Software
9
Software Characteristics
requirements.
software must be extended to make it interoperable with
11
Factors Contributing to the Software Crisis
Larger problems,
Lack of adequate training in software
engineering,
Increasing skill shortage,
Low productivity improvements.
12
Some Software failures
Windows XP
✓ Microsoft released Windows XP on October 25, 2001.
✓ On the same day company posted 18 MB of
compatibility patches on the website for bug fixes,
compatibility updates, and enhancements.
✓ Two patches fixed important security holes.
15
The IEEE definition:
Software Engineering: (1) The application of a
systematic, disciplined, quantifiable approach to
the development, operation, and maintenance of
software; that is, the application of engineering to
software.
“State of the art of developing quality software on
time and within budget”
16
Software engineering is a field of engineering,
for designing and writing programs for computers or
other electronic devices. A software engineer,
or programmer, writes software or changes existing
software and compiles software using methods that
improve it.
17
Definition of Software Process
It is a framework for the activities, actions, and tasks
that are required to build high-quality software.
It defines the approach that is taken as software is
engineered.
Software engineering: A layered technology of process–
technical methods and automated tools.
18
A Layered Technology
tools
methods
process model
a “quality” focus
Software Engineering
19
A Layered Technology
Methods: Methods are general guidelines that govern
the execution of some activity. Methods include a
broad array of tasks that include communication,
requirements analysis, design modeling, program
construction, testing and support.
Tools: Tools are developed to provide support for
process and methods.
20
Software engineers use many tools and practices in
making software. Some of the most common are:
•Flowcharts
•UML diagram
•Debugging tools
•Compiler
•Text editor etc.
•Computer Aided Software Engineering (CASE) is
example of Integrated tool.
21
A Process Framework
Process framework
Framework activities
work tasks
work products
milestones & deliverables
QA checkpoints
Umbrella Activities
22
Framework Activities
Communication
Planning
Modeling
Analysis of requirements
Design
Construction
Code generation
Testing
Deployment
23
Umbrella Activities
Software Project Management
Formal Technical Reviews
Software Quality Assurance
Software Configuration Management
Work Product Preparation and Production
Reusability Management
Measurement
Risk management
24
Software Process Models
✓A software process model is an abstract representation
of a process. It presents a description of a process from
some particular viewpoint as:
✓1. Specification.
✓2. Design.
✓3. Validation.
✓4. Evolution.
25
Process models
26
Software Development Activities
Requirements Establish customer’s needs
Collection
Analysis Model and specify the requirements
(“what”)
Design Model and specify a solution (“how”)
28
A Generic Process Model
◼ a generic process framework for software engineering
defines five framework activities-communication,
planning, modeling, construction, and deployment.
◼ In addition, a set of umbrella activities- project tracking
and control, risk management, quality assurance,
configuration management, technical reviews, and
others are applied throughout the process.
29
Identifying a Task Set
◼ A task set defines the actual work to be done to
accomplish the objectives of a software engineering
action.
◼ A list of the task to be accomplished
requirements.
◼ 4. E-mail to stakeholder for review and approval. 31
Example of a Task Set for Elicitation
◼ The task sets for Requirements gathering action for a
simple project may include:
1. Make a list of stakeholders for the project.
functions required.
4. Discuss requirements and build a final list.
5. Prioritize requirements.
33
UNIT-I
Introduction to Software Engineering : The Evolving role of Software.
Software characteristics and applications, Evolution of Software
Engineering, Software crisis. The Software Engineering challenges, The
Software Engineering approach. Software development life cycle.
Software Development Process Models (Paradigms): Waterfall
Model. Prototyping, Iterative Development, Spiral Model. Software
Project: Planning a Software Project. Effort Estimation: (COCOMO
and Function Points Model), Project Scheduling, Staffing and Personnel
Planning, Software Configuration Management Plan, Quality Assurance
Plans, Project Monitoring Plans, Risk Management.
1
The Waterfall Model
2
•It is the oldest paradigm for SE. When requirements are
well defined and reasonably stable, it leads to a linear
fashion.
•The classic life cycle suggests a systematic, sequential
approach to software development.
Problems: 1. rarely linear, iteration needed. 2. hard to state
all requirements explicitly. 3.Blocking state. 4. code will
not be released until very late.
3
Waterfall model
✓ Classical model of software engineering
Basic Principles
✓ Project is divided into sequential phases, with some overlap and
5
The following list details the steps for using the waterfall model:
System requirements
7
Waterfall Model - Advantages
✓ Simple and easy to understand and use.
✓ Easy to manage due to the rigidity of the model. ...
✓ Phases are processed and completed one at a time.
✓ Works well for smaller projects where requirements are very
well understood.
✓ Clearly defined stages.
✓ Well understood milestones.
✓ Easy to arrange tasks.
✓ Reinforces good habits: define-before- design, design-before-
code
8
Disadvantages
✓ Idealized, doesn’t match reality well.
✓ it does not allow much reflection or revision.
✓ Once an application is in the testing stage, it is very difficult to
go back and change something that was not well-documented or
thought upon in the concept stage.
✓ Software is delivered late in project, delays discovery of serious
errors.
✓ Difficult to integrate risk management.
✓ Difficult and expensive to make changes.
9
Incremental Process Models
10
The Incremental Model
11
Basic Principles
✓Iterative model, the project is divided into small parts.
✓Allows the development team to make obvious results
earlier in the process and obtain valuable feedback from
system users.
✓Each iteration is actually a mini-Waterfall process with
the feedback from one phase providing critical
information for the design of the next phase.
12
The Incremental model
Software releases in increments.
1st increment constitutes Core product.
Basic requirements are addressed.
Core product undergoes detailed evaluation by the
customer.
As a result, plan is developed for the next increment,
Plan addresses the modification of core product to better
meet the needs of customer.
Process is repeated until the complete product is produced.
13
When to use iterative model:
✓ Requirements of the complete system are clearly
defined and understood.
✓ When the project is big.
✓ Major requirements must be defined; however, some
details can evolve with time.
14
Advantages
✓ Generates working software quickly and early during the
software life cycle.
✓ More flexible
✓ less costly to change scope and requirements
✓ Easier to test and debug during a smaller iteration.
✓ Easier to manage risk because risky pieces are identified and
handled during its iteration.
✓ Allows feedback to proceeding stages
✓ Can be used where the requirements are not well understood
15
Disadvantages
✓ Needs good planning and design.
✓ Needs a clear and complete definition of the whole
system before it can be broken down and
built incrementally.
✓ Total cost is higher than waterfall.
✓ Not easy to manage this model.
✓ No clear milestones in the development process.
16
THE RAD MODEL
(Rapid Application Development)
17
When to use RAD Methodology?
•When a system needs to be produced in a short span of time
(2-3 months)
•When the requirements are known
•When the user will be involved all through the life cycle
•When technical risk is less
•When there is a necessity to create a system that can be
modularized in 2-3 months of time
•When a budget is high enough to afford designers for
modeling along with the cost of automated tools for code
generation 18
The RAD Model Team # n
Modeling
Business modeling
Data modeling
Process modeling
Construction
Team # 2 Component reuse
automatic code
generation
Communication Modeling testing
Business modeling
Data modeling
Process modeling
Construction
Planning Team # 1 Component reuse
automatic code
generation
testing
Modeling
Business modeling Deployment
Data modeling integration
Process modeling delivery
feedback
Construction
Component reuse
automatic code
generation
testing
19
THE RAD MODEL
Multiple software teams work in parallel on different functions
Modeling encompasses three major phases: Business modeling,
Data modeling and process modeling
Construction uses reusable components, automatic code generation
and testing
Problems in RAD
Requires a number of RAD teams
Requires commitment from both developer and customer for rapid-
fire completion of activities
Requires modularity
Not suited when technical risks are high 20
Phases of RAD model Activities performed in RAD Model
21
➢ Process Modeling: The data object that is declared in
the data modeling phase is transformed to achieve the
information flow necessary to implement a business
function
11
The Spiral Model
An evolutionary model which combines the best
feature of the classical life cycle and the iterative
nature of prototype model.
Include new element : Risk element.
12
13
Basic Principles
✓ Focus is on risk assessment.
✓ Minimizing project risk by breaking a project into smaller
segments.
✓ Providing more relieve-of-change during the development
process.
✓ Each cycle involves a progression through the same sequence
of steps.
✓ Begin each cycle with an identification of stakeholders and
their win conditions, and end each cycle with review and
assurance. 14
The Spiral Model
Realistic approach to the development of large scale
system and software.
Software evolves as process progresses.
Better understanding between developer and customer.
The first circle might result in the development of a
product specification.
Subsequent circles develop a prototype.
And sophisticated version of software.
15
When to use Spiral model:
✓ When costs and risk evaluation is important
✓ For medium to high-risk projects
✓ Long-term project commitment
✓ Users are unsure of their needs
✓ Requirements are complex
16
Advantages Disadvantages
analysis. use.
18
Features Water fall Incremental Prototyping Spiral
19
Conclusion
✓ Water Fall Model is commonly Used for Software Process
Modeling.
14
The following factors must be considered when selecting a software project team
structure ...
the difficulty of the problem to be solved.
the size of the resultant program(s) in lines of code or function
points.
the time that the team will stay together (team lifetime).
the degree to which the problem can be modularized.
the required quality and reliability of the system to be built.
the rigidity of the delivery date.
the degree of sociability (communication) required for the
project.
Scope ( Answers of following questions)
Context. How does the software to be built fit into a larger system,
product, or business context and what constraints are imposed as a
result of the context?
Information objectives. What customer-visible data objects are
produced as output from the software? What data objects are
required for input?
Function and performance. What function does the software
perform to transform input data into output? Are any special
performance characteristics to be addressed?
✓Software project scope must be unambiguous and
understandable at the management and technical levels.
✓A statement of software scope must be bounded.
✓That is, quantitative data (e.g., number of simultaneous
users, target environment, maximum allowable response
time) are stated explicitly,
✓constraints and/or limitations(e.g., product cost restricts
memory size) are noted
17
Sometimes called partitioning or problem elaboration
Once scope is defined …
◦ It is decomposed into essential functions
◦ It is decomposed into user-visible data objects
or
◦ It is decomposed into a set of problem classes
Decomposition process continues until all functions or
problem classes have been defined.
18
Once a process framework has been established
◦ Consider project characteristics
◦ Determine the degree of strictness required
◦ Define a task set for each software engineering activity
Task set =
Software engineering tasks
Work products
Quality assurance points
Milestones
19
Projects get into trouble when …
◦ Software people don’t understand their customer’s needs.
◦ The product scope is poorly defined.
◦ Changes are managed poorly.
◦ The chosen technology changes.
◦ Business needs change [or are unclear].
◦ Deadlines are unrealistic.
◦ Users are resistant.
◦ Sponsorship is lost [or was never properly obtained].
◦ The project team lacks people with appropriate skills.
◦ Managers [and practitioners] avoid best practices and lessons
learned.
20
Software Project Planning
Cost Estimation
A number of estimation techniques have been developed and are having following attributes
in common :
✓ Software metrics are used as a basis from which estimates are made
✓ The project is broken into small pieces which are estimated individually
✓ Use simple decomposition techniques to generate project cost and schedule estimates
Released systems
Custom configured systems (different functionality)
System(s) under development
Software must run on different machines and operating systems
Promotion management
Release management
Branch management
Variant management
Change management
No fixed rules:
SCM functions are usually performed in different ways
Promotion management
is the creation of versions for other developers
Release management
is the creation of versions for the clients and users
Branch management
is the management of concurrent development
Variant management
is the management of versions intended to live
Change management
is the handling, approval and tracking of change requests
Configuration Manager
SCM Roles
Responsible for identifying configuration items. The configuration
Developer
Creates promotions triggered by change requests or the normal
What are
Configuration Items
Baselines
SCM Directories
Baseline A (developmental)
All changes relative to baseline A
Baseline B (functional)
All changes relative to baseline B
Baseline C (beta test)
All changes relative to baseline C
Official Release
SCM Directories
Programmer’s Directory (IEEE: Dynamic Library)
Library for holding newly created or modified software entities.
The programmer’s workspace is controlled by the programmer
only.
Master Directory (IEEE: Controlled Library)
Manages the current baseline(s) and for controlling changes made
to them. Entry is controlled, usually after verification. Changes
must be authorized.
Software Repository (IEEE: Static Library)
Archive for the various baselines released for general use. Copies
of these baselines may be made available to requesting
organizations.
Change management
Change management is the handling of change requests
A change request leads to the creation of a new release
developers)
The change request is assessed against project goals
The complexity of the change management process varies with the project.
Small projects can perform change requests informally and fast while
complex projects require detailed change request forms and the official
approval by one more managers.
Version vs. Revision vs. Release
Version:
An initial release or re-release of a configuration item
naming scheme.
creation of baselines.
configuration information.
Outline of a Software Configuration
Management Plan (SCMP, IEEE 828-1990)
1. Introduction 4. Schedule (WHEN?)
Describes purpose, scope of Establishes the sequence and
application, key terms and references coordination of the SCM activities
2. Management (WHO?) with project mile stones.
Identifies the responsibilities and
5. Resources (HOW?)
authorities for accomplishing the
Identifies tools and techniques
planned configuration management
required for the implementation of the
activities
SCMP
3. Activities (WHAT?)
6. Maintenance
Identifies the activities to be
Identifies activities and responsibilities
performed in applying to the project.
on how the SCMP will be kept current
during the life-cycle of the project.
Tools for Software Configuration Management
Software configuration management is normally supported by tools
with different functionality.
Examples:
RCS
Assess request
Reject request
Approve request
Assign change
Implement change
Validate change
UNIT-II Software Requirement Analysis And Specification: Need
for SRS, Problem Analysis, Requirements Specification. Software
Design: Design objectives and principles. Module level concepts,
Coupling and Cohesion. Design Notations and specifications.
Structured Design Methodology, Object Oriented Design. Detailed
Design: Detailed Design, Verification (Design Walkthroughs, Critical
Design Review, Consistency Checkers), Metrics.
Requirements describe What not How
Produces one large document written in natural language
contains a description of what the system will do without
describing how it will do it.
Types
Functional requirements describe what the software has
to do. They are often called product features.
Non Functional requirements are mostly quality
requirements. That stipulate how well the software does,
what it has to do.
User and system requirements
• User requirement are written for the users and include
functional and non functional requirement.
• System requirement are derived from user
requirement.
• The user system requirements are the parts of software
requirement and specification (SRS) document.
Requirements Documentation
SRS Should
-- Correctly define all requirements
-- not describe any design details
-- not impose any additional constraints
Characteristics of a good SRS: An SRS Should be
✓ Correct
✓ Unambiguous
✓ Complete
✓ Consistent
✓Ranked for important and/or stability
✓ Verifiable
✓ Modifiable
✓ Traceable
Requirements Documentation
✓Correct
An SRS is correct if and only if every requirement
stated therein is one that the software shall meet.
✓Unambiguous
An SRS is unambiguous if and only if, every
requirement stated therein has only one interpretation.
✓Complete
An SRS is complete if and only if, it includes the
following elements
i)All significant requirements, whether related to
functionality, performance, design constraints,
attributes or external interfaces.
ii) Responses to both valid & invalid inputs.
(iii) Full Label and references to all figures, tables and
diagrams in the SRS and definition of all terms and units
of measure.
✓ Consistent
An SRS is consistent if and only if, no subset of individual
requirements described in it conflict.
✓Verifiable
An SRS is verifiable, if and only if, every requirement stated
therein is verifiable.
✓Modifiable
An SRS is modifiable, if and only if, its structure and style are such
that any changes to the requirements can be made easily,
completely, and consistently while retaining structure and style.
✓Traceable
An SRS is traceable, if the origin of each of the requirements is
clear and if it facilitates the referencing of each requirement in
future development or enhancement documentation.
Organization of the SRS
IEEE has published guidelines and standards to
organize an SRS. First two sections are same. The
specific tailoring occurs in section-3.
Software Design
MODULARITY
A
Relationship between Cohesion & Coupling
If the software is not properly modularized, changes will
result into death of the project. Therefore, a software
engineer must design the modules with goal of high
cohesion and low coupling.
Differentiate between Coupling and Cohesion
Coupling Cohesion
Coupling is also called Inter-Module Cohesion is also called Intra-Module
Binding. Binding.
Coupling shows the relationships Cohesion shows the relationship within
between modules. the module.
Coupling shows the Cohesion shows the module's
relative independence between the relative functional strength.
modules.
While creating, you should aim for low While creating you should aim for high
coupling, i.e., dependency among cohesion, i.e., a cohesive component/
modules should be less. module focuses on a single function (i.e.,
single-mindedness) with little interaction
with other modules of the system.
1. Problem Partitioning
2. Abstraction
3. Modular
4. Strategy of Design: Top-down Approach & Bottom-
up Approach
1. Problem Partitioning:
• For small problem, we can handle the entire problem at once
but for the significant problem, divide the problems and
conquer the problem it means to divide the problem into
smaller pieces so that each piece can be captured separately.
• For software design, the goal is to divide the problem into
manageable pieces.
• These pieces cannot be entirely independent of each other as
they together form the system. They have to cooperate and
communicate to solve the problem. This communication
adds complexity.
Structured Design
✓ Structured design is a conceptualization of problem into
several well-organized elements of solution.
✓ Structured design is mostly based on ‘divide and conquer’
strategy where a problem is broken into several small
problems and each small problem is individually solved
until the whole problem is solved.
✓ A good structured design always follows some rules for
communication among multiple modules, namely -
Cohesion - grouping of all functionally related elements.
Coupling - communication between different modules.
Function Oriented Design
✓ Function oriented design inherits some properties of
structured design where divide and conquer methodology
is used.
✓ In function-oriented design, the system is comprised of
many smaller sub-systems known as functions.
✓ These functions are capable of performing significant task
in the system.
✓ The system is considered as top view of all functions.
2. Abstraction
An abstraction is a tool that enables a designer to
consider a component at an abstract level without
bothering about the internal details of the
implementation. There are two common abstraction
mechanisms
1.Functional Abstraction
2.Data Abstraction
Functional Abstraction
i.A module is specified by the method it performs.
ii.The details of the algorithm to accomplish the functions are
not visible to the user of the function.
Functional abstraction forms the basis for Function oriented
design approaches.
Data Abstraction
Details of the data elements are not visible to the users of
data. Data Abstraction forms the basis for Object Oriented
design approaches.
3. Modularity
Modularity specifies to the division of software into
separate modules which are differently named and
addressed and are integrated later on in to obtain the
completely functional software. It is the only property
that allows a program to be intellectually manageable.
Single large programs are difficult to understand and
read due to a large number of reference variables, control
paths, global variables, etc.
The desirable properties of a modular system are:
•Each module is a well-defined system that can be
used with other applications.
•Each module has single specified objectives.
•Modules can be separately compiled and saved in the
library.
•Modules should be easier to use than to build.
•Modules are simpler from outside than inside.
4. Strategy of Design
A good system design strategy is to organize the program
modules in such a method that are easy to develop and latter
too, change. Structured design methods help developers to deal
with the size and complexity of programs. Analysts generate
instructions for the developers about how code should be
composed and how pieces of code should fit together to form a
program.
To design a system, there are two possible approaches:
1.Top-down Approach
2.Bottom-up Approach
1. Top-down Approach: This approach starts with the
identification of the main components and then
decomposing them into their more detailed sub-
components.
2. Bottom-up Approach: A bottom-up approach begins
with the lower details and moves towards up the hierarchy,
as shown in fig. This approach is suitable in case of an
existing system.
Different levels of Software Design:
The software design process can be divided into the
following three levels of phases of design:
1.Interface Design
2.Architectural Design
3.Detailed Design
1. Interface Design: Interface design is the
specification of the interaction between a system and its
environment. This phase proceeds at a high level of
abstraction with respect to the inner workings of the
system i.e, during interface design, the internal of the
systems are completely ignored and the system is
treated as a black box.
Interface design should include the following details:
✓ Precise description of events in the environment, or
messages from agents to which the system must respond.
✓ Precise description of the events or messages that the
system must produce.
✓ Specification on the data, and the formats of the data
coming into and going out of the system.
✓ Specification of the ordering and timing relationships
between incoming events or messages, and outgoing
events or outputs.
2. Architectural Design: Architectural design is the
specification of the major components of a system,
their responsibilities, properties, interfaces, and the
relationships and interactions between them. In
architectural design, the overall structure of the system
is chosen, but the internal details of major components
are ignored.
Issues in architectural design includes:
✓ Gross decomposition of the systems into major
components.
✓ Allocation of functional responsibilities to
components.
✓ Component Interfaces.
✓ Communication and interaction between components.
3. Detailed Design: Design is the specification of the internal
elements of all major system components, their properties,
relationships, processing, and often their algorithms and the data
structures.
The detailed design may include:
•Decomposition of major system components into program
units.
•Allocation of functional responsibilities to units.
•User interfaces
•Data and control interaction between units
•Algorithms and data structures
UNIT-II Software Requirement Analysis And Specification:
Need for SRS, Problem Analysis, Requirements Specification.
Software Design: Design objectives and principles. Module
level concepts, Coupling and Cohesion. Design Notations and
specifications. Structured Design Methodology, Object Oriented
Design. Detailed Design: Detailed Design, Verification (Design
Walkthroughs, Critical Design Review, Consistency Checkers),
Metrics.
Design Notations
Design notations are largely meant to be used during the
process of design and are used to represent design or
design decisions. For a function oriented design, the
design can be represented graphically or mathematically
by the following:
✓ Data flow diagrams
✓ Data Dictionaries
✓ Structure Charts
✓ Pseudocode
Data Dictionaries
✓ A data dictionary is a file or a set of files that includes
a database's metadata.
✓ The data dictionary hold records about other objects in
the database, such as data ownership, data
relationships to other objects, and other data.
✓ Typically, only database administrators interact with
the data dictionary.
The data dictionary, in general, includes information
about the following:
✓ Name of the data item
✓ Aliases
✓ Description/purpose
✓ Related data items
✓ Range of values
✓ Data structure definition/Forms
1. The name of the data item is self-explanatory.
2. Aliases include other names by which this data item is
called DEO for Data Entry Operator and DR for Deputy
Registrar.
3. Description/purpose is a textual description of what the
data item is used for or why it exists.
4. Related data items capture relationships between data
items e.g., total_marks must always equal to
internal_marks plus external_marks.
5. Range of values records all possible values, e.g. total
marks must be positive and between 0 to 100.
6. Data structure Forms: Data flows capture the name of
processes that generate or receive the data items.
The scheme of organizing related information is known as ‘data structure’.
The types of data structure are:
Lists: A group of similar items with connectivity to the previous or/and next
data items.
Arrays: A set of homogeneous values
Records: A set of fields, where each field consists of data belongs to one
data type.
Trees: A data structure where the data is organized in a hierarchical
structure. This type of data structure follows the sorted order of insertion,
deletion and modification of data items.
Tables: Data is persisted in the form of rows and columns. These are similar
to records, where the result or manipulation of data is reflected for the whole
table.
✓ A structure chart (SC) in software engineering and
organizational theory is a chart which shows the
breakdown of a system to its lowest manageable levels.
✓ They are used in structured programming to arrange
program modules into a tree.
✓ Each module is represented by a box, which contains
the module's name.
✓ Structure Chart partitions the system into black boxes
(functionality of the system is known to the users but
inner details are unknown).
✓ Structure Chart represent hierarchical structure of
modules.
✓ Inputs are given to the black boxes and appropriate
outputs are generated.
✓ Modules at top level called modules at low level.
✓ Components are read from top to bottom and left to
right.
Symbols used in construction of structured chart
1.Module
It represents the process or task of the system. It is of three
types.
1.Control Module: A control module branches to more
than one sub module.
2.Sub Module: Sub Module is a module which is the
part (Child) of another module.
3.Library Module: Library Module are reusable and
invokable from any module.
2. Conditional Call: It represents that control module
can select any of the sub module on the basis of some
condition.
3. Loop (Repetitive call of module): It represents the
repetitive execution of module by the sub module.
A curved arrow represents loop in the module. All the sub
modules cover by the loop repeat execution of module.
4. Data Flow: It represents the flow of data between the
modules. It is represented by directed arrow with empty
circle at the end.
5. Control Flow: It represents the flow of control
between the modules. It is represented by directed arrow
with filled circle at the end.
4. Risk while using this analysis 4. Risk while using this analysis
It can find the bugs in the It can only find the bugs that
early stage of the could not be found by the
development. verification process.
The goal of verification is
The goal of validation is an
application and software
actual product.
architecture and specification.
Validation is executed on
Quality assurance team does
software code with the help of
verification.
testing team.
It comes before validation. It comes after verification.
It consists of checking of It consists of execution of
documents/files and is program and is performed by
performed by human. computer.
Software Measurement and Metrics
productivity = KLOC/person-month
quality = faults/KLOC
cost = $$/KLOC
documentation = doc_pages/KLOC
16
UNIT-III
Software Implementation: Implementation issues, Coding.
Programming Practices: Structured coding and object
oriented coding techniques, Modern programming language
features. Verification and Validation techniques (Code reading,
Static Analysis, Symbolic Execution, Proving Correctness,
Code Inspections or Reviews, Unit Testing). Coding:
Programming Principles and guidelines, Coding Process
Metrics: Size Measures, Complexity Metrics, Style Metrics.
Documentation: Internal and External Documentation.
Halstead's Software Metrics
According to Halstead's "A computer program is an
implementation of an algorithm considered to be a collection of
tokens which can be classified as either operators or operand.”
Halstead’s metrics are included in a number of current
commercial tools that count tokens and determine which are
operators and which are operands.The following base measures
can be collected :
n1 = count of unique operators.
n2 = count of unique operands.
N1 = count of total occurrences of operators.
N2 = count of total occurrence of operands.
Size of program (N): In terms of the total tokens
used, the size of the program can be expressed as:
N = N1 + N2.
Size of Vocabulary (n)
The size of the vocabulary of a program, which consists
of the number of unique tokens used to build a program,
is defined as:
n = n1+n2
where
n=vocabulary of a program
n1=number of unique operators
n2=number of unique operands
Productivity = FP/person-month
quality = faults/FP
cost = $$/FP
documentation = doc_pages/FP
Differentiate between FP and LOC
FP LOC
1. FP is specification 1. LOC is an analogy based.
based.
2. FP is language 2. LOC is language dependent.
independent.
3. FP is user-oriented. 3. LOC is design-oriented.
4. It is extendible to LOC. 4. It is convertible to FP
(backfiring)
UNIT-III
Software Implementation: Implementation issues, Coding.
Programming Practices: Structured coding and object
oriented coding techniques, Modern programming language
features. Verification and Validation techniques (Code reading,
Static Analysis, Symbolic Execution, Proving Correctness,
Code Inspections or Reviews, Unit Testing). Coding:
Programming Principles and guidelines, Coding Process
Metrics: Size Measures, Complexity Metrics, Style Metrics.
Documentation: Internal and External Documentation.
Information Flow Metrics
Information Flow metrics measure the information flowing among
modules of the system. It is responsive to the complexity due to
interconnection among system components. This measure also
includes the complexity of a software module, which is the sum of all
the complexities of the methods present in the module.
A procedure contributes complexity due to the following two factors.
The complexity of the process code itself.
The complexity due to the process's linkage to other processes. The
effect of the first case has been included through the LOC (Line Of
Code) measure. For estimating the second case, Henry and Kafura
have described two terminologies: FAN IN and FAN OUT.
FAN-IN: FAN-IN of a component is a count of the number of
other components that can call or pass information to that
component.
FAN -OUT: FAN-OUT of a component is the number of
components that are called by or receive information from that
component.
The figure given below shows a fragment of a system design
having component 'A,' for which we can define three measures:
‘FAN-IN’ is a count of the number of other components calling or
passing control to A.
‘FAN-OUT’ is the number of components called by A.
3. The information flow index
of component A, abbreviated as
IF(A), is derived from the first
two components by using the
following formula-
IF(A) = [ FAN-IN(A) * FAN-
OUT(A) ]2
Ques. Consider the following system. Calculate FAN-IN and
FAN-OUT of A, and what do they indicate?
FAN-IN(A) = 3, FAN-OUT(A) = 2
1. High FAN-IN indicates this module has
been used heavily. This shows the
reusability of modules and thus reduces
redundancy in the coding.
2. High FAN-OUT indicates a highly
coupled module, thus more dependency
on other modules.
Information Flow metrics are applied to the
Components of a system design.
This metrics is based on the measurement of the
information flow among system modules.
It is sensitive to the complexity due to interconnection
among system component.
This measure includes the complexity of a software
module is defined to be the sum of complexities of
the procedures included in the module.
Fig. shows a fragment of such a design, and for
component ‘A’ we can define three measures, but these
are the simplest models of IF.
1. ‘FAN IN’ is simply a count of the number of other
Components that can call, or pass control, to
Component A.
2. ‘FANOUT’ is the number of Components that are
called by Component A.
3. This is derived from the first two by using the following
formula. We will call this measure the INFORMATION
FLOW index of Component A, abbreviated as IF(A).
IF(A) = [FAN IN(A) x FAN OUT (A)]2
4. Calculate the IF value for each Component using the
above formula.
5. Sum the IF value for all Components within each level
which is called as the LEVEL SUM.
6. Sum the IF values for the total system design which is
called the SYSTEM SUM.
The following is a step-by-step guide to calculate IF metrics.
1. Note the level of each Component in the system design.
2. For each Component, count the number of calls so that
Component – this is the FAN IN of that Component. Some
organizations allow more than one Component at the highest
level in the design, so for Components at the highest level
which should have a FAN IN of zero, assign a FAN IN of
one. Also note that a simple model of FAN IN can penalize
reused Components.
3. For each Component, count the number of calls from the
Component. For Component that call no other, assign a
FAN OUT value of one.
4. Calculate the IF value for each Component using the
above formula.
5. Sum the IF value for all Components within each level
which is called as the LEVEL SUM.
6. Sum the IF values for the total system design which is
called the SYSTEM SUM.
A More Sophisticated Information Flow Model
a = the number of components that call A.
b = the number of parameters passed to A from
components higher in the hierarchy.
c = the number of parameters passed to A from
components lower in the hierarchy.
d = the number of data elements read by component A.
Then:
FAN IN(A)= a + b + c + d
Also let:
e = the number of components called by A;
f = the number of parameters passed from A to components
higher in the hierarchy;
g = the number of parameters passed from A to
components lower in the hierarchy;
h = the number of data elements written to by A.
Then:
FAN OUT(A)= e + f + g + h
Cyclomatic Complexity
Flow Graph
The control flow of a program can be analysed using a
graphical representation known as flow graph. The flow
graph is a directed graph in which nodes are either entire
statements or fragments of a statement, and edges
represents flow of control.
Fig.: The basic construct of the flow graph
Cyclomatic Complexity may Cyclomatic
Meaning
Complexity
be defined as-
Structured and Well
• It is a software metric that Written Code
1 – 10
measures the logical High Testability
Less Cost and Effort
complexity of the program
Complex Code
code.
10 – 20 Medium Testability
• It counts the number of Medium Cost and Effort
decisions in the given Very Complex Code
program code. 20 – 40 Low Testability
• It measures the number of High Cost and Effort
Method-01:
Cyclomatic Complexity
= Total number of closed regions in the control flow graph + 1
=2+1
=3
Method-02:
Cyclomatic Complexity
=E–N+2
=8–7+2
=3
Method-03:
Cyclomatic Complexity
=P+1
=2+1
=3
UNIT-III
Software Implementation: Implementation issues, Coding.
Programming Practices: Structured coding and object
oriented coding techniques, Modern programming language
features. Verification and Validation techniques (Code reading,
Static Analysis, Symbolic Execution, Proving Correctness,
Code Inspections or Reviews, Unit Testing). Coding:
Programming Principles and guidelines, Coding Process
Metrics: Size Measures, Complexity Metrics, Style Metrics.
Documentation: Internal and External Documentation.
Software Implementation Issues
✓ If-then-else is frequently
called alternation (because
there are alternative options).
✓ In structured programming,
each choice is a code block.
✓ The alternation of two code
blocks is structured.
Rule 4 of Structured Programming: Iteration
Fault: The fault that causes the failure is in line 5. The * operator is
1 program double ();
used instead of +.
2 var x,y: integer;
3 begin
4 read(x); Error: The error that leads to this fault may be:
5 y := x * x; • a typing error (the developer has written * instead of +)
6 write(y) • a conceptual error (e.g., the developer doesn't know how to double
7 end a number)
Manual Vs Automated Testing
process
Objective of a Software Tester
Find bugs as early as possible and make sure they get fixed.
To understand the application well.
Study the functionality in detail to find where the bugs are likely to occur.
Study the code to ensure that each and every line of code is tested.
Test Oracle is a mechanism, different from the program itself, that can be used
to test the accuracy of a program’s output for test cases. Conceptually, we can
consider testing a process in which test cases are given for testing and the
program under test. The output of the two then compared to determine whether
the program behaves correctly for test cases.
✓ Testing oracles are required for testing.
✓ Ideally, we want an automated oracle, which always gives the correct answer.
However, often oracles are human beings, who mostly calculate by hand what the
output of the program should be.
✓ The human oracles typically use the program’s specifications to decide what the
correct behaviour of the program should be.
✓ A complete oracle would have three capabilities and would carry them out
perfectly:
✓ A generator, to provide predicted or expected results for each test.
✓ A comparator, to compare predicted and obtained results.
✓ An evaluator, to determine whether the comparison results are sufficiently close to
be a pass.
Test Oracle
Oracle
Validate the observed output against the expected output
Instructions:
Tell the tester exactly what to do.
many.
If you are trying to show the program correct, your subconscious
percentage of them.
Limitations of Testing
Testing can be used to show the presence of bugs, but never their absence
Testing is successful if the program fails
Testing cannot guarantee the correctness of software but can be effectively
used to find errors (of certain types)
Testing Objectives
The Major Objectives of Software Testing
Uncover as many as errors (or bugs) as possible in a given timeline.
specifications.
Validate the quality of a software testing using the minimum cost and
efforts.
Generate high quality test cases, perform effective tests, and issue correct
application
Cost-effective testing methodology, coverage, test methods, and tools.
software
Structural testing: Generating test cases based on the structure of the program
Black box testing and white box testing are synonyms for functional and
testing process
In white box testing internal structure of the program is taken into account.
Parameter Black Box testing White Box testing
Definition It is a testing approach which is used to It is a testing approach in which
test the software without the knowledge internal structure is known to the
of the internal structure of program or tester.
application.
Alias It also knowns as data-driven, box It is also called structural testing,
testing, data-, and functional testing. clear box testing, code-based
testing, or glass box testing.
Base of Testing Testing is based on external expectations; Internal working is known, and
internal behavior of the application is the tester can test accordingly.
unknown.
Usage This type of testing is ideal for higher Testing is best suited for a lower
levels of testing like System Testing, level of testing like Unit Testing,
Acceptance testing. Integration testing.
Programming Programming knowledge is not needed to Programming knowledge is
knowledge perform Black Box testing. required to perform White Box
Parameter Black Box testing White Box testing
Implementation Implementation knowledge is not Complete understanding needs to
knowledge requiring doing Black Box testing. implement WhiteBox testing.
Automation Test and programmer are dependent White Box testing is easy to
on each other, so it is tough to automate.
automate.
Objective The main objective of this testing is The main objective of White Box
to check what functionality of the testing is done to check the quality of
system under test. the code.
Basis for test cases Testing can start after preparing Testing can start after preparing for
requirement specification Detail design document.
document.
Tested by Performed by the end user, Usually done by tester and
developer, and tester. developers.
Testing method It is based on trial and error Data domain and internal boundaries
method. can be tested.
Parameter Black Box testing White Box testing
Time It is less exhaustive and time- Exhaustive and time-consuming
consuming. method.
Algorithm test Not the best method for algorithm Best suited for algorithm testing.
testing.
Code Access Code access is not required for Black White box testing requires code access.
Box Testing. Thereby, the code could be stolen if
testing is outsourced.
Benefit Well suited and efficient for large code It allows removing the extra lines of
segments. code, which can bring in hidden defects.
Skill level Low skilled testers can test the Need an expert tester with vast
application with no knowledge of the experience to perform white box testing.
implementation of programming
language or operating system.
Parameter Black Box testing White Box testing
Techniques Equivalence partitioning is Black Statement Coverage, Branch
box testing technique is used for coverage, and Path coverage are
Blackbox testing. White Box testing technique.