Unit 2 - Software Engineering - WWW - Rgpvnotes.in
Unit 2 - Software Engineering - WWW - Rgpvnotes.in
Tech
Subject Name: Software Engineering
Subject Code: IT-604
Semester: 6th
Downloaded from www.rgpvnotes.in
Software Metrics
A software metric is a measure of software characteristics which are measurable or countable. Software
metrics are valuable for many reasons, including measuring software performance, planning work items,
measuring productivity, and many other uses.
Within the software development process, many metrics are that are all connected. Software metrics are
similar to the four functions of management: Planning, Organization, Control, or Improvement.
Classification of Software Metrics
Software metrics can be classified into two types as follows:
1. Product Metrics: These are the measures of various characteristics of the software product. The two
important software characteristics are:
1. Size and complexity of software.
2. Quality and reliability of software.
These metrics can be computed for different stages of SDLC.
2. Process Metrics: These are the measures of various characteristics of the software development process.
For example, the efficiency of fault detection. They are used to measure the characteristics of methods,
techniques, and tools that are used for developing software.
Types of Metrics
Internal metrics: Internal metrics are the metrics used for measuring properties that are viewed to be of
greater importance to a software developer. For example, Lines of Code (LOC) measure.
External metrics: External metrics are the metrics used for measuring properties that are viewed to be of
greater importance to the user, e.g., portability, reliability, functionality, usability, etc.
Hybrid metrics: Hybrid metrics are the metrics that combine product, process, and resource metrics. For
example, cost per FP where FP stands for Function Point Metric.
Project metrics: Project metrics are the metrics used by the project manager to check the project's progress.
Data from the past projects are used to collect various metrics, like time and cost; these estimates are used as
a base of new software. Note that as the project proceeds, the project manager will check its progress from
time-to-time and will compare the effort, cost, and time with the original effort, cost and time. Also understand
that these metrics are used to decrease the development costs, time efforts and risks. The project quality can
also be improved. As quality improves, the number of errors and time, as well as cost required, is also reduced.
Advantage of Software Metrics
Comparative study of various design methodology of software systems.
For analysis, comparison, and critical study of different programming language concerning their
characteristics.
In comparing and evaluating the capabilities and productivity of people involved in software development.
In the preparation of software quality specifications.
In the verification of compliance of software systems requirements and specifications.
In making inference about the effort to be put in the design and development of the software systems.
In getting an idea about the complexity of the code.
In taking decisions regarding further division of a complex module is to be done or not.
In guiding resource manager for their proper utilization.
In comparison and making design tradeoffs between software development and maintenance cost.
In providing feedback to software managers about the progress and quality during various phases of the
software development life cycle.
In the allocation of testing resources for testing the code.
Disadvantage of Software Metrics
The application of software metrics is not always easy, and in some cases, it is difficult and costly.
The verification and justification of software metrics are based on historical/empirical data whose validity is
difficult to verify.
These are useful for managing software products but not for evaluating the performance of the technical staff.
The definition and derivation of Software metrics are usually based on assuming which are not standardized
and may depend upon tools available and working environment.
Most of the predictive models rely on estimates of certain variables which are often not known precisely.
Based on the LOC/KLOC count of software, many other metrics can be computed:
1. Errors/KLOC.
2. $/ KLOC.
3. Defects/KLOC.
4. Pages of documentation/KLOC.
5. Errors/PM.
6. Productivity = KLOC/PM (effort is measured in person-months).
7. $/ Page of documentation.
Advantages of LOC
1. Simple to measure
Disadvantage of LOC
1. It is defined on the code. For example, it cannot measure the size of the specification.
2. It characterizes only one specific view of size, namely length, it takes no account of functionality or
complexity
3. Bad software design may cause an excessive line of code
4. It is language dependent
5. Users cannot easily understand it
Objectives of FPA
The basic and primary purpose of the functional point analysis is to measure and provide the software
application functional size to the client, customer, and the stakeholder on their request. Further, it is used to
measure the software project development along with its maintenance, consistently throughout the project
irrespective of the tools and the technologies.
Following are the points regarding FPs
1. FPs of an application is found out by counting the number and types of functions used in the applications.
Various functions used in an application can be put under five types, as shown in Table:
Types of FP Attributes
Measurements Parameters Examples
1.Number of External Inputs (EI) Input screen and tables
2. Number of External Output (EO) Output screens and reports
3. Number of external inquiries (EQ) Prompts and interrupts.
4. Number of internal files (ILF) Databases and directories
5. Number of external interfaces (EIF) Shared databases and shared routines.
All these parameters are then individually assessed for complexity.
1. FP characterizes the complexity of the software system and hence can be used to depict the project time
and the manpower requirement.
2. The effort required to develop the project depends on what the software does.
3. FP is programming language independent.
4. FP method is used for data processing systems, business systems like information systems.
5. The five parameters mentioned above are also known as information domain characteristics.
6. All the parameters mentioned above are assigned some weights that have been experimentally determined
and are shown in Table
Weights of 5-FP Attributes
Measurement Parameter Low Average High
The functional complexities are multiplied with the corresponding weights against each function, and the
values are added up to determine the UFP (Unadjusted Function Point) of the subsystem.
Here that weighing factor will be simple, average, or complex for a measurement parameter type.
The Function Point (FP) is thus calculated with the following formula.
= Count-total * CAF
and ∑(fi) is the sum of all 14 questionnaires and show the complexity adjustment value/ factor-CAF (where i
ranges from 1 to 14). Usually, a student is provided with the value of ∑(fi)
Also note that ∑(fi) ranges from 0 to 70, i.e.,
0 <= ∑(fi) <=70
and CAF ranges from 0.65 to 1.35 because
1. When ∑(fi) = 0 then CAF = 0.65
2. When ∑(fi) = 70 then CAF = 0.65 + (0.01 * 70) = 0.65 + 0.7 = 1.35
1. Degree of Influence (DI) for each of these 14 GSCs is assessed on a scale of 0 to 5. (b) If a particular
GSC has no influence, then its weight is taken as 0 and if it has a strong influence then its weight is 5.
2. The score of all 14 GSCs is totaled to determine Total Degree of Influence (TDI).
3. Then Value Adjustment Factor (VAF) is computed from TDI by using the formula:
VAF = (TDI * 0.01) + 0.65
Remember that the value of VAF lies within 0.65 to 1.35 because
1. When TDI = 0, VAF = 0.65
2. When TDI = 70, VAF = 1.35
3. VAF is then multiplied with the UFP to get the final FP count: FP = VAF * UFP
Example: Compute the function point, productivity, documentation, cost per function for the following data:
1. Number of user inputs = 24
2. Number of user outputs = 46
3. Number of inquiries = 8
4. Number of files = 4
5. Number of external interfaces = 2
6. Effort = 36.9 p-m
7. Technical documents = 265 pages
8. User documents = 122 pages
9. Cost = $7744/ month
Various processing complexity factors are: 4, 1, 0, 3, 3, 5, 4, 4, 3, 3, 2, 2, 4, 5.
Solution:
Measurement Parameter Count Weighing factor
FP LOC
Token Count
In these metrics, a computer program is considered to be a collection of tokens, which may be classified as
either operators or operands. All software science metrics can be defined in terms of these basic symbols.
These symbols are called as a token.
Program Difficulty
The difficulty level or error-proneness (D) of the program is proportional to the number of the unique operator
in the program.
D= (n1/2) * (N2/n2)
The following alternate expressions have been published to estimate program length:
NJ = log2 (n1!) + log2 (n2!)
NB = n1 * log2n2 + n2 * log2n1
NC = n1 * sqrt(n1) + n2 * sqrt(n2)
NS = (n * log2n) / 2
Language Level - Shows the algorithm implementation program language level. The same algorithm
demands additional effort if it is written in a low-level program language. For example, it is easier to program
in Pascal than in Assembler.
L' = V / D / D
2
lambda = L * V* = L * V
Language levels
Language Language level λ Variance σ
PL/1 1.53 0.92
ALGOL 1.21 0.74
FORTRAN 1.14 0.81
CDC Assembly 0.88 0.42
PASCAL 2.54 -
APL 2.42 -
C 0.857 0.445
Example: Consider the sorting program as shown in fig: List out the operators and operands and also calculate
the value of software science measure like n, N, V, E, λ ,etc.
= 14 log214+10 log2)10
= 14 * 3.81+10 * 3.32
= 53.34+33.2=86.45
Since L=V*/V
This is probably a reasonable time to produce the program, which is very simple.
Cyclomatic Complexity
Cyclomatic complexity is a software metric used to measure the complexity of a program. Thomas J. McCabe
developed this metric in 1976.McCabe interprets a computer program as a set of a strongly connected directed
graph. Nodes represent parts of the source code having no branches and arcs represent possible control flow
transfers during program execution. The notion of program graph has been used for this measure, and it is
used to measure and control the number of paths through a program. The complexity of a computer program
can be correlated with the topological complexity of a graph.
Static, Single Variable Models: When a model makes use of single variables to calculate desired values
such as cost, time, efforts, etc. is said to be a single variable model. The most common equation is:
C=aLb
Where C = Costs
L= size
a and b are constants
The Software Engineering Laboratory established a model called SEL model, for estimating its software
production. This model is an example of the static, single variable model.
E=1.4L0.93
DOC=30.4L0.90
D=4.6L0.26
Static, Multivariable Models: These models are based on method (1), they depend on several variables
describing various aspects of the software development environment. In some model, several variables are
needed to describe the software development process, and selected equation combined these variables to
give the estimate of time & cost. These models are called multivariable models.
WALSTON and FELIX develop the models at IBM provide the following equation gives a relationship
between lines of source code and effort:
E=5.2L0.91
The productivity index uses 29 variables which are found to be highly correlated productivity as follows:
Where Wi is the weight factor for the ithvariable and Xi={-1,0,+1} the estimator gives Xione of the values -1,
0 or +1 depending on the variable decreases, has no effect or increases the productivity.
Example: Compare the Walston-Felix Model with the SEL model on a software development expected to
involve 8 person-years of effort.
1. Calculate the number of lines of source code that can be produced.
2. Calculate the duration of the development.
3. Calculate the productivity in LOC/PY
4. Calculate the average manning
Solution:
The amount of manpower involved = 8PY=96persons-months
(a)Number of lines of source code can be obtained by reversing equation to give:
Then
L (SEL) = (96/1.4)1⁄0.93=94264 LOC
L (SEL) = (96/5.2)1⁄0.91=24632 LOC
(b)Duration in months can be calculated by means of equation
D (SEL) = 4.6 (L) 0.26
= 4.6 (94.264)0.26 = 15 months
D (W-F) = 4.1 L0.36
= 4.1 (24.632)0.36 = 13 months
(c) Productivity is the lines of code produced per persons/month (year)
(d)Average manning is the average number of persons required per month in the project
COCOMO Model
Boehm proposed COCOMO (Constructive Cost Estimation Model) in 1981.COCOMO is one of the most
generally used software estimation models in the world. COCOMO predicts the efforts and schedule of a
software product based on the size of the software.
The initial estimate (also called nominal estimate) is determined by an equation of the form used in the static
single variable models, using KDLOC as the measure of the size. To determine the initial effort E i in person-
months the equation used is of the type is shown below
Ei=a*(KDLOC)b
The value of the constant a and b are depends on the project type.
1.Organic: A development project can be treated of the organic type, if the project deals with developing a
well-understood application program, the size of the development team is reasonably small, and the team
members are experienced in developing similar methods of projects. Examples of this type of projects are
simple business systems, simple inventory management systems, and data processing systems.
2. Semidetached: A development project can be treated with semidetached type if the development consists
of a mixture of experienced and inexperienced staff. Team members may have finite experience in related
systems but may be unfamiliar with some aspects of the order being developed. Example of Semidetached
system includes developing a new operating system (OS), a Database Management System (DBMS), and
complex inventory management system.
3. Embedded: A development project is treated to be of an embedded type, if the software being developed
is strongly coupled to complex hardware, or if the stringent regulations on the operational method exist. For
Example: ATM, Air Traffic control.
For three product categories, Bohem provides a different set of expression to predict effort (in a unit of person
month) and development time from the size of estimation in KLOC (Kilo Line of code) efforts estimation
takes into account the productivity loss due to holidays, weekly off, coffee breaks, etc.
According to Boehm, software cost estimation should be done through three stages:
1. Basic Model
2. Intermediate Model
3. Detailed Model
1. Basic COCOMO Model: The basic COCOMO model provide an accurate size of the project parameters.
The following expressions give the basic COCOMO estimation model:
Effort=a1*(KLOC) a2 PM
Tdev=b1*(efforts)b2 Months
Where
KLOC is the estimated size of the software product indicate in Kilo Lines of Code,
a1,a2,b1,b2 are constants for each group of software products,
Tdev is the estimated time to develop the software, expressed in months,
Effort is the total effort required to develop the software product, expressed in person months (PMs).
Estimation of development effort
For the three classes of software products, the formulas for estimating the effort based on the code size are
shown below:
Some insight into the basic COCOMO model can be obtained by plotting the estimated characteristics for
different software sizes. Fig shows a plot of estimated effort versus product size. From fig, we can observe
that the effort is somewhat superliner in the size of the software product. Thus, the effort required to develop
a product increases very rapidly with project size.
The development time versus the product size in KLOC is plotted in fig. From fig it can be observed that the
development time is a sub linear function of the size of the product, i.e. when the size of the product increases
by two times, the time to develop the product does not double but rises moderately. This can be explained by
the fact that for larger products, a larger number of activities which can be carried out concurrently can be
identified. The parallel activities can be
carried out simultaneously by the engineers. This reduces the time to complete the project. Further, from fig,
it can be observed that the development time is roughly the same for all three categories of products. For
example, a 60 KLOC program can be developed in approximately 18 months, regardless of whether it is of
organic, semidetached, or embedded type.
From the effort estimation, the project cost can be obtained by multiplying the required effort by the manpower
cost per month. But, implicit in this project cost computation is the assumption that the entire project cost is
incurred on account of the manpower cost alone. In addition to manpower cost, a project would incur costs
due to hardware and software required for the project and the company overheads for administration, office
space, etc.
It is important to note that the effort and the duration estimations obtained using the COCOMO model are
called a nominal effort estimate and nominal duration estimate. The term nominal implies that if anyone tries
to complete the project in a time shorter than the estimated duration, then the cost will increase drastically.
But, if anyone completes the project over a longer period of time than the estimated, then there is almost no
decrease in the estimated cost value.
Example1: Suppose a project was estimated to be 400 KLOC. Calculate the effort and development time for
each of the three model i.e., organic, semi-detached & embedded.
Example2: A project size of 200 KLOC is to be developed. Software development team has average
experience on similar type of projects. The project schedule is not very tight. Calculate the Effort, development
time, average staff size, and productivity of the project.
Solution: The semidetached mode is the most appropriate mode, keeping in view the size, schedule and
experience of development time.
Hence E=3.0(200)1.12=1133.12PM
D=2.5(1133.12)0.35=29.3PM
P = 176 LOC/PM
2. Intermediate Model: The basic Cocomo model considers that the effort is only a function of the number
of lines of code and some constants calculated according to the various software systems. The intermediate
COCOMO model recognizes these facts and refines the initial estimates obtained through the basic COCOMO
model by using a set of 15 cost drivers based on various attributes of software engineering.
Classification of Cost Drivers and their attributes:
(i) Product attributes -
Required software reliability extent
Size of the application database
The complexity of the product
Hardware attributes -
Run-time performance constraints
Memory constraints
The volatility of the virtual machine environment
Required turnabout time
Personnel attributes -
Analyst capability
Software engineering capability
Applications experience
Virtual machine experience
Programming language experience
Project attributes -
Use of software tools
Application of software engineering methods
Required development schedule
The cost drivers are divided into four categories:
3. Detailed COCOMO Model:Detailed COCOMO incorporates all qualities of the standard version with an
assessment of the cost driver?s effect on each method of the software engineering process. The detailed model
uses various effort multipliers for each cost driver property. In detailed cocomo, the whole software is
differentiated into multiple modules, and then we apply COCOMO in various modules to estimate effort and
then sum the effort.
The Six phases of detailed COCOMO are:
1. Planning and requirements
2. System structure
3. Complete structure
4. Module code and test
5. Integration and test
6. Cost Constructive model
The effort is determined as a function of program estimate, and a set of cost drivers are given according to
every phase of the software lifecycle.