software size metrics: summary software size /1

23
SENG 521 SENG 521 Software Reliability & Software Reliability & Software Reliability & Software Reliability & Software Quality Software Quality Chapter 2: Software Size Chapter 2: Software Size Department of Electrical & Computer Engineering, University of Calgary B.H. Far [email protected]B.H. Far [email protected]http://www.enel.ucalgary.ca/People/far/Lectures/SENG521 Contents Contents S ft i Software size Size: Length (code, specification, design) Size: Reuse Size: Functionality (function point, feature point, object point, use-case point) Size: Complexity [email protected] 2 Software Size Metrics: Summary Software Size Metrics: Summary Requirement Length Design Code LOC LOC Software F ti lit Code Halstead’s Halstead’s Function point Function point Feature point Feature point Software size Functionality Feature point Feature point Use Use-case point case point Obj i Obj i Complexity Object point Object point Cyclomatic complexity Cyclomatic complexity Reuse Reuse level Reuse level Reuse frequency Reuse frequency [email protected] 3 Reuse density Reuse density Software Size /1 Software Size /1 It l d t tt ib t d ib ft Internal product attributes describe a software product in a way that is dependent only on the product itself product itself. One of the most useful attributes is the size of a software product which can be measured statically software product, which can be measured statically, i.e., without executing the system. It is necessary to define software size in terms of It is necessary to define software size in terms of more than one internal attributes, each capturing a key aspect of software size. key aspect of software size. Size measurement must reflect effort, cost and productivity. [email protected] 4 productivity. Software Size /2 Software Size /2 Sf i b d ib d b l h Software size can be described by length, functionality, and complexity. Length is the physical product size. Functionality is a measure of the functions supplied by h d h the product to the user. Complexity is a multi-faceted attribute which can be it tdi lti l interpreted in multiple ways. Reuse is also an issue in size, specifically the i f i hi amount or size of reuse within a program. [email protected] 5 Software Size: Length Software Size: Length hi h “h i li fh d Length is the physical sizeof the product. In a software development effort, there are three major development products: specification, design, and code. The length of the specification can indicate how long the design is likely to be, which in turn is a predictor of code length. Traditionally code length refers to text-based code Traditionally, code length refers to text based code length. [email protected] 6

Upload: others

Post on 20-Apr-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Software Size Metrics: Summary Software Size /1

SENG 521SENG 521Software Reliability & Software Reliability & Software Reliability & Software Reliability & Software QualitySoftware Qualityyy

Chapter 2: Software SizeChapter 2: Software Size

Department of Electrical & Computer Engineering, University of Calgary

B.H. Far ([email protected])B.H. Far ([email protected])http://www.enel.ucalgary.ca/People/far/Lectures/SENG521

ContentsContentsS ft i Software size

Size: Length (code, specification, design) Size: Reuse Size: Functionality (function point,

feature point, object point, use-case point)p )

Size: Complexity

[email protected] 2

Software Size Metrics: Summary Software Size Metrics: Summary Requirement

Length

q

Design

CodeLOCLOC

Software F ti lit

CodeHalstead’sHalstead’s

Function pointFunction point

Feature pointFeature pointSoftware size Functionality Feature pointFeature point

UseUse--case pointcase point

Obj iObj i

Complexity

Object pointObject point

Cyclomatic complexityCyclomatic complexity

Reuse

Reuse levelReuse level

Reuse frequencyReuse frequency

[email protected] 3Reuse densityReuse density

Software Size /1Software Size /1I t l d t tt ib t d ib ft Internal product attributes describe a software product in a way that is dependent only on the product itselfproduct itself.

One of the most useful attributes is the size of a software product which can be measured staticallysoftware product, which can be measured statically, i.e., without executing the system.

It is necessary to define software size in terms of It is necessary to define software size in terms of more than one internal attributes, each capturing a key aspect of software size.key aspect of software size.

Size measurement must reflect effort, cost and productivity.

[email protected] 4

productivity.

Software Size /2Software Size /2S f i b d ib d b l h Software size can be described by length, functionality, and complexity. Length is the physical product size. Functionality is a measure of the functions supplied by

h d hthe product to the user. Complexity is a multi-faceted attribute which can be

i t t d i lti linterpreted in multiple ways. Reuse is also an issue in size, specifically the

i f i hiamount or size of reuse within a program.

[email protected] 5

Software Size: Length Software Size: Length h i h “ h i l i ” f h d Length is the “physical size” of the product.

In a software development effort, there are three major development products: specification, design, and code.

The length of the specification can indicate how long the design is likely to be, which in turn is a g g y ,predictor of code length.

Traditionally code length refers to text-based code Traditionally, code length refers to text based code length.

[email protected] 6

Page 2: Software Size Metrics: Summary Software Size /1

Length: Code Length: Code –– LOC /1LOC /1The most commonly used measure of source code The most commonly used measure of source code program length is the number of lines of code (LOC). ( ) NCLOC: non-commented source line of code or effective

lines of code (ELOC). CLOC t d li f d CLOC: commented source line of code.

By measuring NCLOC and CLOC separately we can define:can define:

total length (LOC) = NCLOC + CLOC The ratio: CLOC/LOC measures the density of The ratio: CLOC/LOC measures the density of

comments in a program.

[email protected] 7

Length: Code Length: Code –– LOC /2LOC /2Variations of LOC:Variations of LOC: Count of physical lines including blank lines.

Count of all lines except blank lines and comments Count of all lines except blank lines and comments. Count of all statements except comments

(statements taking more than one line count as only(statements taking more than one line count as only one line).

Count of all lines except blank lines, comments, p , ,declarations and headings.

Count of only executable statements, not including i di iexception conditions.

[email protected] 8

Length: Code Length: Code –– LOC /3LOC /3M t U it Li f S C d Measurement Unit: Lines of Source Code

Statement Type Includes Excludes

Executable X

Non-executableDeclarations XDeclarations X

Compiler Directives X

Comments X

On their own lines X

On lines with source code X

Banners and nonblank spacers X

Blank (empty) comments X

Blank Lines X

[email protected] 9

Blank Lines X

Length: Code Length: Code –– LOC /4LOC /4Ad t f LOC Advantages of LOC Simple and automatically measurable Correlates with programming effort (& cost)

Di d f LOC Disadvantage of LOC Vague definition Language dependability Not available for early planningy p g Developers’ skill dependability Encouraging “sumo” development!

[email protected] 10

Encouraging sumo development!

Length: Halstead’s Work /1Length: Halstead’s Work /1

Maurice Halstead’s Theory (1971~1979): A program P is a collection of tokens, composed p g , p

of two basic elements: operands and operators Operands are variables, constants, addresses Operands are variables, constants, addresses Operators are defined operations in a

programming languageprogramming language(language constructs)

if … else+ - > = ;

main()

a, b, r100

main()goto

[email protected] 11

Length: Halstead’s Work /2Length: Halstead’s Work /2N b f di ti t t i th ( ) Number of distinct operators in the program (μ1)

Number of distinct operands in the program (μ2) Total number of occurrences of operators in the

program (N1) Total number of occurrences of operands in the

program (N2)

Program vocabulary (μ)μ = μ1 + μ2

[email protected] 12

Page 3: Software Size Metrics: Summary Software Size /1

Length: Halstead’s Work /3Length: Halstead’s Work /3 Program length is the total number of occurrences of Program length is the total number of occurrences of

operators and operands:N = N1 + N2

Program volume is the number of mental comparisons needed to write a program of length N

l lV N N N

Program level (L):

2 1 2 2 1 2log logV N N N

g ( )

h i h i i i i l l (i

* 2

1 2

1 2L V V or LD N

*

where is the minimum size potential volume (i.e., minimal size of implementation) and D is program difficulty

*V

[email protected] 13

Length: Halstead’s Work /4Length: Halstead’s Work /4l h i h l b f Program length is the total number of occurrences

of operators and operands:N = N1 + N2

Program estimated length ( )N̂g g ( )

1 2 1 2 2 2ˆ log logN

Effort required to generate program P: number of elementary discriminationselementary discriminations

1 22log

2NVE V D N

L

[email protected] 1422L

Length: Halstead’s Work /5Length: Halstead’s Work /5

Time required for developing program P is the total effort divided by the number of yelementary discriminations per second

EET

In cognitive psychology β is usually a number between 5 and 20number between 5 and 20

Halstead claims that β=18

[email protected] 15

Length: Halstead’s Work /6Length: Halstead’s Work /6

Remaining bugs: the number of bugs left in the software at the delivery timey

2/3

3000EB

Conclusion: the bigger program needs more

3000

gg p gtime to be developed and more bugs remainedremained

[email protected] 16

Example 1Example 1

For the following C program:#include<stdio h>#include<stdio h>#include<stdio.h> main() {int a ;

#include<stdio.h> main() {int a ; Operandsint a ;scanf (“%d”, &a);if ( a >= 10 )f ( ) f (" d\ " )

int a ;scanf (“%d”, &a);if ( a >= 10 )f ( ) f (" d\ " )

Operands

if ( a < 20 ) printf ("10 < a< 20 %d\n" , a); else printf ("a >= 20 %d\n" , a);else printf ("a <= 10 %d\n" , a);

if ( a < 20 ) printf ("10 < a< 20 %d\n" , a); else printf ("a >= 20 %d\n" , a);else printf ("a <= 10 %d\n" , a);}}

[email protected] 17

Example 1 (cont’d)Example 1 (cont’d)

Determine number of operators (μ1). Determine number of operands (μ2).Determine number of operands (μ2). Determine the program length in terms of

th t t l b f f tthe total number of occurrences of operators (N1) and operands (N2): N = N1 + N2

Estimate program length

[email protected] 18

Page 4: Software Size Metrics: Summary Software Size /1

Example 1 (cont’d)Example 1 (cont’d)O t N b f O t N b fOperators Number of

occurrencesOperators Number of

occurrences# 1 <= 1include 1 \n 3stdio.h 1 printf 3

1 3< … > 1 < 3main 1 >= 2( … ) 7 if … else 2( … ) 7 if … else 2{ … } 1 & 1int 1 , 4; 5 %d 4scanf 1 “ … “ 4

[email protected] 19

μ1 = 20 N1 = 47

Example 1 (cont’d)Example 1 (cont’d)

Operands Number of occurrencesa 10a 1010 320 3

μ2 = 3 N2 = 16μ1 = 20 N1 = 47Program length: N = N1 + N2 = 63Program Estimated length:

1 2 1 2 2 2 2 2ˆ log log 20log 20 3log 3 91.1934N

[email protected] 20

Example 2Example 2For the following program calculate Halstead’s (c1) For the following program calculate Halstead’s (c1) number of operators; (c2) number of operands; (c3) program vocabulary; (c4) occurrences of operators p g y; ( ) pin the program; (c5) occurrences of operands in the program; (c6) program length; (c7) program volume; (c8) program estimated lengthvolume; (c8) program estimated length.1: read x,y,z;2: type = “scalene”;yp ;3: if (x == y or x == z or y == z) type =“isosceles”;4: if (x == y and x == z) type =“equilateral”;5: if (x >= y+z or y >= x+z or z >= x+y) type =“not a triangle”;6: if (x <= 0 or y <= 0 or z <= 0) type =“bad inputs”;7: print type;

[email protected] 21

Example 2 (cont’d)Example 2 (cont’d)

Operators Operandsread 1 == 5 strings 5, 2 or 6 x 9; 7 and 1 y 8“ … ” 6 >= 3 z 8= 5 <= 3 0 3= 5 <= 3 0 3if 4 + 3 type 6( ) 4 print 1( ) 4 print 1

μ1 = 14N1 = 51

μ2 = 6N2 = 39

[email protected] 22

N1 51 N2 39

Example 2 (cont’d)Example 2 (cont’d)( 1) N b f di ti t t i th 1 14(c1) Number of distinct operators in the program: μ1 = 14(c2) Number of distinct operands in the program: μ2 = 6(c3) Program vocabulary: μ = μ1 + μ2 = 20(c3) Program vocabulary: μ = μ1 + μ2 = 20(c4) Total number of occurrences of operators in the program:

N1 = 51(c5) Total number of occurrences of operands in the program:

N2 = 39(c6) Program length: N = N1 + N2 = 90(c7) Program volume: V = N log2 μ = 90 log2 (20) = 388.9735( 8) P i d l h(c8) Program estimated length:

1 2 1 2 2 2 2 2ˆ log log 14log 14 6log 6 68.81274N

[email protected] 23

Length: Halstead’s Work /7Length: Halstead’s Work /7C iti f H l t d’ kCritics of Halstead’s work Developed in the context of assembly languages and

t fi i d f d itoo fine grained for modern programming languages. Th t t t f b i d d i d i The treatment of basic and derived measures is somehow confusing.Th ti f ti t d l d i i b The notions of time to develop and remaining bugs are arguable.U bl t b t d d t i l d th i f Unable to be extended to include the size for specification and design.

[email protected] 24

Page 5: Software Size Metrics: Summary Software Size /1

Length: Alternative MethodsLength: Alternative MethodsAlt ti th d f t t b d t Alternative methods for text-based measurement of code length:

1) Source memory size: Measuring length in terms of1) Source memory size: Measuring length in terms of number of bytes of computer storage required for the program text. Excludes library code.p g y

2) Char size: Measuring length in terms of number of characters (CHAR) in program text.

3) Object memory size: Measuring length in terms of an object (executable or binary) file. Includes library code.

All are relatively easy to measure (or estimate) All are relatively easy to measure (or estimate).

[email protected] 25

Length: Code Length: Code –– Problems /1 Problems /1 One of the problems with text based definition of One of the problems with text-based definition of length is that the line of code measurement is increasingly less meaningful as software g y gdevelopment turns to more automated tools, such as:

T l th t t d f ifi ti Tools that generate code from specifications Visual programming tools

What can be the length measure for objects that are What can be the length measure for objects that are not textual?

How can one account for components that areHow can one account for components that are constructed externally? (library, repository, inherited functions, design patterns, etc.)

[email protected] 26

Length: Code Length: Code –– Problems /2 Problems /2

The LOC size measurement needs to be replaced by some other size measures, such p yas: Object points (as used in COCOMO 2 0) etc Object points (as used in COCOMO 2.0), etc. Measuring length by taking into account the

reused portion of codereused portion of code.

[email protected] 27

Length: Spec. & DesignLength: Spec. & DesignS ifi ti d d i d t ll Specification and design documents are usually composed of logical text (axioms, constraints, etc.) and diagrams (flow graphs etc )and diagrams (flow graphs, etc.)

Define atomic objects to measure textual contents and graphical contents e gand graphical contents, e.g.,

DiagramDiagram Atomic objectsAtomic objectsData-flow diagram bubblesData dictionary Data elementE tit l ti hi di Obj t l tiEntity-relationship diagram Objects, relationsState transition diagrams States, transitions

[email protected] 28

Length: PredictionLength: PredictionTh ti ll i f d i b d t Theoretically, size of design can be used to predict size of code.

Each project has a design-to-code expansion ratio. If design is measured by the number of g ymodules of size si, then:

m

i h d i d i i

1i

iLOC s

σ is the design-to-code expansion ratio

recorded for previous similar projects.

[email protected] 29 [email protected] 30

Page 6: Software Size Metrics: Summary Software Size /1

Measuring Software Size:Measuring Software Size:Measuring Software Si e:Measuring Software Si e:Function Point (FP), Feature Function Point (FP), Feature Point Object Point and UsePoint Object Point and UsePoint, Object Point and UsePoint, Object Point and Use--case Pointcase Point

Review: Software SizeReview: Software Size Size measurement must reflect effort cost and productivity Size measurement must reflect effort, cost and productivity. Size-oriented metrics are direct measures of software and the

process by which it was developed. These metrics include ff ( i ) f deffort (time), money spent, LOC, pages of documents

created, errors, and number of staff. Defining software size in terms of length, functionality, andDefining software size in terms of length, functionality, and

complexity, each capturing a key aspect of software size. Basic measure for length is LOC. Simple size-oriented

metrics can be generated from LOC such as:metrics can be generated from LOC, such as: Productivity = KLOC / person-month Quality = defects / KLOC

i f d / Documentation = pages of documents / KLOC etc.

[email protected] 32

Length: Length: Problem with LOCProblem with LOCD di h d/ di Depending on the programmer and/or coding standards, the "line of code" could be, and usually is, written on many separate lines:written on many separate lines:

for (i=0; i<100; ++i) {

printf("hello"); } /* N h li f d i thi ? */ } /* Now how many lines of code is this? */

In this example we have: 4 Physical Lines of Code (is placing braces worth to be estimated?) 4 Physical Lines of Code (is placing braces worth to be estimated?) 2 Logical Line of Code (What about all the work writing non-statement

lines?) 1 C Li (?) 1 Comment Line (?)

[email protected]

FunctionFunction--Oriented MetricsOriented MetricsF ti P i t (FP) i i ht d f ft Function Point (FP) is a weighted measure of software functionality.

The idea is that a product with more functionality will be The idea is that a product with more functionality will be larger in size.

Function-oriented metrics are indirect measures of software which focus on functionality and utility.

The first function-oriented metrics was proposed by Albrecht (1979 1983) who suggested a productivity measurement(1979~1983) who suggested a productivity measurement approach called the Function Point (FP) method.

Function points (FPs) measure the amount of functionality in p ( ) ya system based upon the system specification.

[email protected] 34

FP: HistoryFP: History

St. Pierre COSMIC

2.0 2.1 2.21.02003200119991997

Full Function Points

IBM1975

Albrecht1979 1984

Function Point Analysis

IFPUG 3.41990 1994

IFPUG 4.0 IFPUG 4.11999

IFPUG 4.22004

Symons UKSMA 1.3.1

1988 1998

1975 1980 1985 1990 1995 2000

Mark II Function Point Analysis

y

[email protected]

FP: Current StatusFP: Current Status 1979: Proposed by Albrecht at IBM 1979: Proposed by Albrecht, at IBM 1983: Gained popularity, Albrecht’s

IEEE paper 1986: International FP user group

established (http://www.ifpug.org) 1990~2004: IFPUG Guidelines to FP 1990~2004: IFPUG, Guidelines to FP

measurement 1998: ISO 14143-FSM: Functional Size

M tMeasurement 1999: IFPUG, FP counting practice

manual, version 4.1, 2004: IFPUG, FP counting practice

manual, version 4.2

[email protected] 36

Page 7: Software Size Metrics: Summary Software Size /1

Function Point (FP) StandardsFunction Point (FP) Standards

StandardStandard NameName ContentContentISO/IEC IFPUG 4.1 Unadjusted functional size measurement

th d C ti ti l14143-1:2000 method -- Counting practices manual IFPUG Function Points VS 4.1 (unadjusted)

ISO/IEC IFPUG 4 2 Unadjusted functional size measurementISO/IEC 20926:2004

IFPUG 4.2 Unadjusted functional size measurement method -- Counting practices manual IFPUG Function Points VS 4.2 (unadjusted) ( j )

ISO/IEC 19761:2003

COSMIC-FFP A functional size measurement method COSMIC Full Function Points Vs. 2.2

ISO/IEC Mark II Function Counting Practices Manual Mark IIISO/IEC 20968:2002

Mark II Function Point Analysis

Counting Practices Manual Mark II Function Points

[email protected]

Function Point (FP) /1Function Point (FP) /1ExternalExternal

External External Inputs Inputs (EI)(EI)

External External Outputs Outputs

(EO) (EO)

FunctionFunction

(EI)(EI)( )( )

FunctionFunctionPoint (FP)Point (FP)

External Interface files (EIF) External Interface files (EIF) I t l L i fil (ILF)I t l L i fil (ILF)

ExternalExternalInquiries (EQ)Inquiries (EQ)

[email protected] 38

Internal Logic files (ILF)Internal Logic files (ILF)q ( Q)q ( Q)

Function Point (FP) /2Function Point (FP) /2i i ( ) i i h d f Function Point (FP) is a weighted measure of

software functionality. FP is computed in two steps:

1) Calculating Unadjusted Function point Count (UFC). 2) Multiplying the UFC by a Value Adjustment Factor

(VAF) The final (adjusted) Function Point is:

FP = UFC VAFFP UFC VAF

[email protected] 39

FP Counting FP Counting SummarySummary

AdjustedFP Count Complexity

Adjustment

Step 2 AdjustedFunction Points

14 Adjustment FactorsAdjustment

Step 1b

Value AdjustmentFactor (VAF)

WeigthedILF

WeightedEIF

WeightedEI

WeightedEO

WeightedEQ

UnadjustedFunction Points(UFP)

W i hti f

Step 1b

=++++

Unadjusted

L A HWeighting offunctional (technical) complexities

Step 1a

L A H L A H L A H L A H

Unadjustedand UnweightedFunction Count

# EI # ILF# EIF# EQ# EOp

[email protected]

1. External 1. External Inputs (EI)Inputs (EI) External Inputs External Inputs –– IFPUG DefinitionIFPUG Definition::

An external input (EI) is an elementary th t d t t lprocess that processes data or control

information that comes from outside the application boundarythe application boundary

The primary intent of an EI is to maintain one or more ILFs and/or to o e o o e s d/o oalter the behavior of the system

E l Example: Data entry by users Data or file feeds by external applications Data or file feeds by external applications

[email protected]

2. External 2. External Outputs (EO)Outputs (EO)External OutputsExternal Outputs IFPUG Definition:IFPUG Definition: External OutputsExternal Outputs –– IFPUG Definition:IFPUG Definition: An external output (EO) is an elementary process

that sends data or control information outside the application boundary

The primary intent of an external output is to present information to a user through processing logic other than, or in addition to, the retrieval of data or control information

The processing logic must contain at least one mathematical formula or calculation, create derived data, maintain one or more ILFs, or alter the behavior of the system

Example: Reports created by the application being counted,Reports created by the application being counted,

where the reports include derived [email protected]

Page 8: Software Size Metrics: Summary Software Size /1

3. External 3. External Inquiries (EQ)Inquiries (EQ)E t l I i iE t l I i i IFPUG D fi itiIFPUG D fi iti External Inquiries External Inquiries –– IFPUG Definition:IFPUG Definition: An external inquiry (EQ) is an elementary

process that sends data or control information outside the application boundaryoutside the application boundary

The primary intent of an external inquiry is to present information to a user through the retrieval of data or control information from anretrieval of data or control information from an ILF or EIF

The processing logic contains no mathematical formulas or calculations, and creates no derived ,data

No ILF is maintained during the processing, nor is the behavior of the system altered

Example: Reports created by the application being

counted where the report does not include anycounted, where the report does not include any derived data

[email protected]

4. Internal 4. Internal Logical Files (ILF)Logical Files (ILF)I l L i l FilI l L i l Fil IFPUGIFPUG Internal Logical Files Internal Logical Files –– IFPUG IFPUG DefinitionDefinition:: An ILF is a user-identifiable group of logicallyAn ILF is a user identifiable group of logically

related data or control information maintained within the boundary of the application

The primary intent of an ILF is to hold data The primary intent of an ILF is to hold data maintained through one or more elementary processes of the application being counted

Example: Tables in a relational database

Fil Files Application control information, perhaps things

like user preferences that are stored by the applicationapplication

[email protected]

5. Ext5. Ext. Interface Files (EIF). Interface Files (EIF)E l I f filE l I f fil IFPUGIFPUG External Interface files External Interface files –– IFPUG IFPUG DefinitionDefinition:: An external interface file (EIF) is a userAn external interface file (EIF) is a user

identifiable group of logically related data or control information referenced by the application, but maintained within the pp ,boundary of another application

The primary intent of an EIF is to hold data referenced through one or more elementaryreferenced through one or more elementary processes within the boundary of the application counted

This means an EIF counted for an application This means an EIF counted for an application must be in an ILF in another application

Example: Example: As for ILF, but maintained in a different system

[email protected]

FP Counting FP Counting SummarySummary

AdjustedFP Count Complexity

Adjustment

Step 2 AdjustedFunction Points

14 Adjustment FactorsAdjustment

Step 1b

Value AdjustmentFactor (VAF)

WeigthedILF

WeightedEIF

WeightedEI

WeightedEO

WeightedEQ

UnadjustedFunction Points(UFP)

W i hti f

Step 1b

=++++

Unadjusted

L A HWeighting offunctional (technical) complexities

Step 1a

L A H L A H L A H L A H

Unadjustedand UnweightedFunction Count

# EI # ILF# EIF# EQ# EOp

[email protected]

Unadjusted FP Count (UFC)Unadjusted FP Count (UFC)A l i i i i d i h h di A complexity rating is associated with each count according to function point complexity weights, below:

Complexity Weighting FactorComplexity Weighting Factor

4 5 4 7 10EI EO EQ EIF ILFUFC N N N N N

ElementElementComplexity Weighting FactorComplexity Weighting FactorLowLow

(Simple)(Simple)AverageAverage

HighHigh(Complex)(Complex)( p )( p ) ( p )( p )

External inputs (NEI) 3 4 6External outputs (NEO) 4 5 7External inquiries (NEQ) 3 4 6External interface files (NEIF) 5 7 10

[email protected] 47

Internal logical files (NILF) 7 10 15

FP Counting: Weighting of FP Counting: Weighting of Technical Complexity Technical Complexity

Sumhighaveragelow

Complexity Weighting FactorElements

External Outputs (EO)

_______ x 6 = _______ x 4 = _______ x 3 = _____External Inputs (EI)

gg

_______ x 6 = _______ x 4 = _______x 3 = _____External Inquiries (EQ)

_______ x 7 = _______ x 5 = _______ x 4 = _____External Outputs (EO)

_______ x15 = _______ x10 = _______ x 7 = _____Internal Logical Files (ILF)

_______ x10 = _______ x 7 = _______ x 5 = _____External Interface Files (EIF)

Unadjusted Function Points (UFP)

(ILF)

[email protected]

Page 9: Software Size Metrics: Summary Software Size /1

Function Types Function Types –– Complexity Complexity AssessmentAssessment

How to assess complexity?

D F i T T i F i TData Function Types Transaction Function Types

Internal Logical Files (ILF)

External Interface Files

(EIF)

External Input (EI)

External Output

(EO)

ExternalInquiry

(EQ)(EIF) (EI) (EO) (EQ)

Elements evaluated for technical

REcord Types (RET): User recognizable sub groups of data elements within an ILF or an EIF It

File Type Referenced (FTR): File type referenced by a transaction An FTR must be anfor technical

complexity assessment

elements within an ILF or an EIF. It is best to look at logical groupings of data to help identify them.

transaction. An FTR must be an Internal Logical File (ILF) or External Interface File (EIF).

Data Element Types (DET): A unique user recognizable non-recursiveData Element Types (DET): A unique user recognizable, non recursive (non-repetitive) field containing dynamic information. If a DET is recursive then only the first occurrence of the DET is considered not every occurrence.

[email protected] 49

Complexity Assessment: EIComplexity Assessment: EId if b f il f d ( ) Identify number of File Types Referenced (FTR)

Identify number of Data Element Type (DET) Determine complexity weight ( used to calculate

FP count))

EI#DET

1-4 5-15 > 151-4 5-15 > 15

#FTR1 low (3) low (3) average (4)2 low (3) average (4) high (6)

> 2 average (4) high (6) high (6)

[email protected]

External Input External Input –– ExampleExampleE t l Enter a new employee with Monthly Payment:

Employee- Name- ID

ILF:Employee

Name ID Birth Date

- Birth Date- Payment Reference

Weekly Payment Monthly Payment

Administration (DB)

Payment Reference Salary Level

- Hourly Rate- Payment Office

- Salary Level

#DETEI

#DET

1-4 5-15 > 15

1 low (3) low (3) average (4)1 FTR#FTR

( ) ( ) g ( )2 low (3) average (4) high (6)

> 2 average (4) high (6) high (6)

1 FTR5 DET

[email protected]

EI EI –– ExampleExample Enter a new employee Enter a new employee

with Weekly Payment:N

Employee- Name- ID

ILF:Employee

Name ID Birth Date Payment Reference

- Birth Date- Payment Reference

Weekly Payment Monthly Payment

Administration (DB)

Payment Reference Hourly Rate Payment Office

- Hourly Rate- Payment Office

- Salary Level

#DETEI

#DET

1-4 5-15 > 15

1 low (3) low (3) average (4)1 FTR#FTR

( ) ( ) g ( )2 low (3) average (4) high (6)

> 2 average (4) high (6) high (6)

1 FTR6 DET

[email protected]

Complexity Assessment: EOComplexity Assessment: EOd if b f il f d ( ) Identify number of File Types Referenced (FTR)

Identify number of Data Element Type (DET) Determine complexity weight ( used to calculate

FP count))

EO#DET

1 5 6 19 > 191-5 6-19 > 19

#FTR1 low (4) low (4) average (5)

2-3 low (4) average (5) high (7)> 3 average (5) high (7) high (7)

[email protected]

EO EO –– ExampleExample Report of all Employees containing Names and

Birth Dates, sorted by age.

≤ 40 YearsILF E l ≤ 40 YearsJerome Iginla, 10-02-1966Rehet Warner, 05-03-1966

≤ 45 Years

ILF: Employee- Name- ID- Birth Date

1 FTR2 DET

Chris Chelios, 23-03-1961Birth Date

- Payment Reference

#DETEO

1-5 6-19 > 191 low (4) low (4) average (5)

#FTR1 low (4) low (4) average (5)

2-3 low (4) average (5) high (7)> 3 average (5) high (7) high (7)

[email protected]

Page 10: Software Size Metrics: Summary Software Size /1

Complexity Assessment: EQComplexity Assessment: EQd if b f il f d ( ) Identify number of File Types Referenced (FTR)

Identify number of Data Element Type (DET) Determine complexity weight ( used to calculate

FP count))

EQ#DET

1-5 6-19 > 19

#FTR1 low (3) low (3) average (4)

2-3 low (3) average (4) high (6)> 3 average (4) high (6) high (6)> 3 average (4) high (6) high (6)

[email protected]

EQ EQ –– ExampleExamplef ll l b l i Report of all employees belonging to Department X

containing Names, Birth Dates, and showing the Department Name“Employee”

ILF: “Employee”

ILF: “Department”

Files (ILF): Employee, Department 2 FTR: Employee, Department

3 DET: Name (Employee), Birth Date (Employee), Department Name (Department)

#DETReport

EQ1-5 6-19 > 19

1 low (3) low (3) average (4)#FTR

1 low (3) low (3) average (4)2-3 low (3) average (4) high (6)> 3 average (4) high (6) high (6)

[email protected]

Complexity Assessment: ILFComplexity Assessment: ILFd if b f d ( ) Identify number of Record Types (RET)

Identify number of Data Element Type (DET) Determine complexity weight ( used to calculate

FP count))

ILF#DET

1-19 20-50 > 50

#RET

1 low (7) low (7) average (10)

2-5 low (7) average high (15)#RET 2-5 low (7) average (10)

high (15)

> 5 average (10) high (15) high (15)

[email protected]

ILF ILF –– ExampleExample

Employee- Name- ID

1 RET4 DET

ILF: “Employee” =

- Birth Date- Payment Reference

4 DETEmployee

ILF#DET

1-19 20-50 > 501 19 20 50 > 50

#RET

1 low (7) low (7) average (10)

2-5 low (7) average (10) high (15)( ) g ( ) g ( )

> 5 average (10) high (15) high (15)

[email protected]

Complexity Assessment: EIFComplexity Assessment: EIFd if b f d ( ) Identify number of Record Types (RET)

Identify number of Data Element Type (DET) Determine complexity weight ( used to calculate

FP count))

EIF#DET

1-19 20-50 > 50

#RET1 low (5) low (5) average (7)

2-5 low (5) average (7) high (10)> 5 average (7) high (10) high (10)> 5 average (7) high (10) high (10)

[email protected]

EIF EIF –– ExampleExampleEmployee- Name- ID- Birth Date

EIF:EmployeeAdministration (DB)Payroll - Payment Reference

Weekly Payment- Hourly Rate

P t Offi

Monthly Payment- Salary Level

d st at o ( )Payroll Software

- Payment Office

EIF#DET

2 RET7 DET

EIF1-19 20-50 > 50

#RET

1 low (5) low (5) average (7)

2 5 l (5) (7) hi h (10)#RET 2-5 low (5) average (7) high (10)

> 5 average (7) high (10) high (10)

[email protected]

Page 11: Software Size Metrics: Summary Software Size /1

FP Counting Example FP Counting Example –– GUIGUI

3 External Inputs

Employee

NameFirst Name

new

change 3 External InputsStreetPostal CodeCityBirth Date

change

delete

close

Birth Date“close” button does not count, because it is not a transaction in its own right involving access to

1 External Inquiry (input side)

External Input (new, 1 FTR, 7 DET, low) = 3 FPE t l I t ( h 1 FTR 7 DET l ) 3 FP

right involving access to ILFs, EIFs

External Input (change, 1 FTR, 7 DET, low) = 3 FPExternal Input (delete, 1 FTR, 7 DET, low) = 3 FPExternal Inquiry (navigate, 1 FTR, 7 DET, low) = 3 FP

12 FP

[email protected]

FP Counting FP Counting SummarySummary

AdjustedFP Count Complexity

Adjustment

Step 2 AdjustedFunction Points

14 Adjustment FactorsAdjustment

Step 1b

Value AdjustmentFactor (VAF)

WeigthedILF

WeightedEIF

WeightedEI

WeightedEO

WeightedEQ

UnadjustedFunction Points(UFP)

W i hti f

Step 1b

=++++

Unadjusted

L A HWeighting offunctional (technical) complexities

Step 1a

L A H L A H L A H L A H

Unadjustedand UnweightedFunction Count

# EI # ILF# EIF# EQ# EOp

[email protected]

Value Adjustment Factor (VAFValue Adjustment Factor (VAF) ) /1/1

l Adj ( A ) ( k h i l Value Adjustment Factor (VAF) (aka. Technical complexity factors) is a weighted sum of 14

i b lcomponents, given below:F1 Data Communications F8 On-line UpdateF2 Distributed Data Processing F9 Complex ProcessingF3 Performance F10 ReusabilityF4 Heavily Used Configuration F11 Installation EaseF5 Transaction Rate F12 Operational EaseF6 On-line Data Entry F13 Multiple SitesF6 On line Data Entry F13 Multiple SitesF7 End-User Efficiency F14 Facilitate Change

[email protected] 63

Value Adjustment Factor (VAF)Value Adjustment Factor (VAF)1 Data Communications: The data and control information used in the application1. Data Communications: The data and control information used in the application

are sent or received over communication facilities. 2. Distributed Data Processing: Distributed data or processing functions are a

characteristic of the application within the application boundarycharacteristic of the application within the application boundary. 3. Performance: Application performance objectives, stated or approved by the

user, in either response or throughput, influence (or will influence) the design, development, installation and support of the application. p , pp pp

4. Heavily Used Configuration: A heavily used operational configuration, requiring special design considerations, is a characteristic of the application.

5. Transaction Rate: The transaction rate is high and influences the design, g gdevelopment, installation and support.

6. On-line Data Entry: On-line data entry and control information functions are provided in the application.

7. End-User Efficiency: The on-line functions provided emphasize a design for end-user efficiency.

SENG421 (Winter 2006) [email protected] 64

Value Adjustment Factor (VAF) Value Adjustment Factor (VAF) 8 On line Update: The application provides on line update for the internal logical8. On-line Update: The application provides on-line update for the internal logical

files. 9. Complex Processing: Complex processing is a characteristic of the application. 10 Reusability: The application and the code in the application have been10. Reusability: The application and the code in the application have been

specifically designed, developed and supported to be usable in other applications. 11. Installation Ease: Conversion and installation ease are characteristics of the

application. A conversion and installation plan and/or conversion tools wereapplication. A conversion and installation plan and/or conversion tools were provided and tested during the system test phase.

12. Operational Ease: Operational ease is a characteristic of the application. Effective start-up, backup and recovery procedures were provided and tested p p y p pduring the system test phase.

13. Multiple Sites: The application has been specifically designed, developed and supported to be installed at multiple sites for multiple organizations.

14. Facilitate Change: The application has been specifically designed, developed and supported to facilitate change.

SENG421 (Winter 2006) [email protected] 65

Value Adjustment Factor (VAFValue Adjustment Factor (VAF) ) /2/2E h t i t d f 0 t 5 h 0 Each component is rated from 0 to 5, where 0 means the component is not relevant to the system and 5 means the component is essentialand 5 means the component is essential.

VAF can then be calculated as:Min = 0

14

0.65 0.01 jVAF F Min = 0

Max = 0.7

VAF varies from 0.65 (if all Fj are set to 0) to 1.35 1

jj

(if all Fj are set to 5) Final Function Point is: FP = UFC VAF

[email protected] 66

Page 12: Software Size Metrics: Summary Software Size /1

Function PointsFunction PointsFunction PointsFunction Points(IFPUG)(IFPUG)

Example 1Example 1

( )( )

FP Example /1aFP Example /1aSpecification: Spell CheckerSpell Checker Checks all words in a document by comparing them

to a list of words in the internal dictionary and anto a list of words in the internal dictionary and an optional user-defined dictionary

After processing the document sends a report on all p g pmisspelled words to standard output

On request from user shows number of words d d d

FP Countprocessed on standard output

On request from user shows number of spelling errors detected on standard outputerrors detected on standard output

Requests can be issued at any point in time while processing the document filep g

[email protected]

FP Example /1bFP Example /1b

Spell CheckerSpell Checker#Errors?#Words?Doc #Errors?#Words?Doc

Convert spec to a di

Spell CheckerDocument

file

Dic.name

name

Spell CheckerDocument

file

Dic.name

name

diagram DictionaryUser personal

Dictionary

DictionaryUser personal

Dictionaryy#Errors#WordsReport

y#Errors#WordsReport

Specification:1. Checks all words in a document by comparing them to a list of words in the internal

dictionary and an optional user-defined dictionary2. After processing the document sends a report on all misspelled words to standard

t toutput3. On request from user shows number of words processed on standard output4. On request from user shows number of spelling errors detected on standard output5. Requests can be issued at any point in time while processing the document file

[email protected]

FP Example /1cFP Example /1c

Spell CheckerSpell Checker Convert spec to a diagram

Inquiries?

Convert spec to a diagram

Inquiries?

Inputs? Outputs?

External file?

Internal file?

[email protected] 70

Internal file?

FP Example /1dFP Example /1dSolution A:• EI: Doc. name + User Dic. name 2

EO: Report + #Words + #Errors 3Dic.name

Docname

Dic.name

Docname• EO: Report + #Words + #Errors 3

• EQ: --• EIF: Document + User Dictionary 2

Spell CheckerDocument

file

namename

Spell CheckerDocument

file

namename

y• ILF: Dictionary 1 DictionaryUser

personalDictionary

#Errors#WordsReport

DictionaryUser personal

Dictionary#Errors#WordsReport

Specification:1. Checks all words in a document by comparing them to a list of words in the internal

dictionary and an optional user-defined dictionary2. After processing the document sends a report on all misspelled words to standard

output

#Errors#WordsReport #Errors#WordsReport

3. On request from user shows number of words processed on standard output4. On request from user shows number of spelling errors detected on standard output5. Requests can be issued at any point in time while processing the document file

EI EO EQ EIF ILFEI EO EQ EIF ILF

[email protected]

FP Example /1eFP Example /1eN 2 ( b f EI) d t NEI=2 (number of EI): document name, user-defined dictionary name

NEO=3 (number of EO): misspelled ElementElement

Weighting FactorWeighting FactorSimple

Average

Complex

O ( ) pword report, number-of-words-processed message, number-of-errors-so-far message

External inputs (EI) 3 4 6

External outputs (EO) 4 5 7 g

NEQ=0 (number of EQ): -- NEIF=2 (number of EIF): document

fil l di ti

(EO)

External inquiries (EQ) 3 4 6

External interface 5 7 10 file, personal dictionary NILF=1 (number of ILF): dictionary

External interface files (EIF) 5 7 10

Internal logical files (ILF) 7 10 15

UFC = 42 + 53 + 40 + 72 + 101 = 47

[email protected]

Page 13: Software Size Metrics: Summary Software Size /1

FP Example /1fFP Example /1fSolution B:• EI: Doc. name + Dic. name 2

EO: Report 1#Errors?#Words?

DiDoc

name#Errors?#Words?

DiDoc

name• EO: Report 1• EQ: #Words? + #Errors? 2• EIF: Document + User Dictionary 2

Spell CheckerDocument

file

Dic.name

name

Spell CheckerDocument

file

Dic.name

name

y• ILF: Dictionary 1 DictionaryUser

personalDictionary

Report

DictionaryUser personal

DictionaryReport

Specification:1. Checks all words in a document by comparing them to a list of words in the internal

dictionary and an optional user-defined dictionary2. After processing the document sends a report on all misspelled words to standard

output

ReportReport

3. On request from user shows number of words processed on standard output4. On request from user shows number of spelling errors detected on standard output5. Requests can be issued at any point in time while processing the document file

EI EO EQ EIF ILFEI EO EQ EIF ILF

[email protected]

FP Example /1gFP Example /1g NEI=2 (number of EI): document

name, user-defined dictionary name N 1 ( b f EO) i ll d

ElementElementWeighting FactorWeighting Factor

Simple

Average

Complex

NEO=1 (number of EO): misspelled word reportN =2 (number of EQ): number of

External inputs (EI) 3 4 6

External outputs (EO) 4 5 7

NEQ=2 (number of EQ): number-of-words-processed message, number-of-errors-so-far message

(EO)

External inquiries (EQ) 3 4 6

External interface 5 7 10o e o s so ess ge

NEIF=2 (number of EIF): document file, personal dictionary

External interface files (EIF) 5 7 10

Internal logical files (ILF) 7 10 15 p y

NILF=1 (number of ILF): dictionary

UFC = 42 + 51 + 42 + 72 + 101 = 45UFC = 42 + 51 + 42 + 72 + 101 = 45

[email protected]

FP Example /1hFP Example /1h

Suppose thatF1=F2=F6=F7=F8=F14= 3;F1 F2 F6 F7 F8 F14 3; F4=F10=5

14

and the rest are zero.VAF 0 65 + 0 01(18+10) + 0 93

10.65 0.01 j

jTCF F

VAF

VAF = 0.65 + 0.01(18+10) + 0.93

Solution A: FP = 47 0.93 ≈ 44Solution A: FP 47 0.93 44Solution B: FP = 45 0.93 ≈ 42

[email protected]

FP Example /1i FP Example /1i –– DiscussionDiscussion

Which solution is correct? Solution A? Solution A? Solution B? None of them? (cf. Fenton’s book)Answer: Solution A is correct!Answer: Solution A is correct!Answer: Solution A is correct!Answer: Solution A is correct!

Why? The difference is because ofWhy? The difference is because of correct interpretation of EO and EQfor the requirement #5q

[email protected]

Function PointsFunction PointsFunction PointsFunction Points(IFPUG)(IFPUG)

Example 2Example 2

( )( )

FP: Example /FP: Example /2a2aConsider the following system that processes Consider the following system that processes various commands from the operator of a chemical plant. Various interactions of the system with the p yoperator and internal and external files are shown.

The system consults two databases for stored d di I h fpressure and temperature readings. In the case of

emergency, the system asks the user whether to send the results to an electronic emergency bulletinsend the results to an electronic emergency bulletin board or not.

Calculate the unadjusted function point count j p(UFC) for this system.

[email protected] 78

Page 14: Software Size Metrics: Summary Software Size /1

FP: Example FP: Example /2b/2bEI EO EQ EIF ILFEI EO EQ EIF ILF

EI EO EQ EIF ILFEI EO EQ EIF ILF

[email protected]

FP: Example FP: Example /2c/2cN b f t l i t 2 NEI number of external inputs 2

NEO number of external outputs 3 NEQ number of external inquiries 1Q q NEIF number of external interface files 2 NILF number of internal logical files 1

ILFEIFEQEOEI NNNNNUFC 107454

UFC = 4x2 + 5x3 + 4x1 + 7x2 + 10x1 = 51

[email protected]

Review: Software SizeReview: Software SizeSi t t fl t ff t t d d ti it Size measurement must reflect effort, cost and productivity.

Defining software size in terms of length, functionality, and complexity, each capturing a key aspect of software size.complexity, each capturing a key aspect of software size.

Basic measure for length is LOC. Basic measure for functionality is Function Point (FP).y ( ) FP is computed in two steps:

1) Calculating an Unadjusted Function point Count (UFC). 2) Multiplying the UFC by a Value Adjustment Factor (VAF).

The final (adjusted) Function Point is:FP UFC VAFFP = UFC VAF

FP variations: feature point, object point, use-case point.

[email protected] 81

FP vs. LOC /1FP vs. LOC /1A b f t di h tt t d t l t A number of studies have attempted to relate LOC and FP metrics (Jones, 1996).

The average number of source code statements per function point has been p pderived from case studies for numerous programming languages. p g g g g

Languages have been classified into different levels according to the relationship betweenlevels according to the relationship between LOC and FP.

[email protected] 82

FP vs. LOC /2FP vs. LOC /2

Language LevelMin

(LOC)Average(LOC)

Max(LOC)

Machine language 0.10 640Assembly 1.00 237 320 416C 2 50 60 128 170C 2.50 60 128 170Pascal 4.00 90C++ 6 00 40 55 140C++ 6.00 40 55 140Visual C++ 9.50 34PowerBuilder 20.00 16Excel 57.00 5.5Code generators -- 15

[email protected] 83

FP vs. LOC /2FP vs. LOC /2L T i l SLOC FPLanguage Typical SLOC per FP1GL Default Language 3202GL Default Language 1073GL Default Language 804GL Default Language 20Code generators 15Assembler 320C 148Basic 107Pascal 90

[email protected] 84

Pascal 90

Page 15: Software Size Metrics: Summary Software Size /1

FP vs. LOC /3FP vs. LOC /3Language Typical SLOC per FP

C# 59C++ 60C++ 60

PL/SQL 46Java 2 60Java 2 60

Visual Basic 50Delphi 18Delphi 18

HTML 4 14SQL 13Excel 47

Newer Data!

[email protected] 85

http://www.qsm.com/FPGearing.html

Effort Estimation with FPEffort Estimation with FP

FPMM (IBM data)3000

3500

Poin

tsEffort estimation

2000

2500

Func

tion based on

organization-ifi d t

1000

1500

Fspecific datafrom pastprojects

0

500Person-Months

projects.

00 100 200 300 400

[email protected]

FP: Advantages FP: Advantages –– SummarySummaryC b t d b f d i d Can be counted before design or code documents exist

Can be used for estimating project cost, effort schedule early in the project life-cycleeffort, schedule early in the project life cycle

Helps with contract negotiations Is standardized (though several competing

standards exist)standards exist)

[email protected]

FP: CriticsFP: CriticsFP is a subjective measure: affected by the selection FP is a subjective measure: affected by the selection of weights by external users.

Function point calculation requires a full software Function point calculation requires a full software system specification. It is therefore difficult to use function points very early in the software d l lif ldevelopment lifecycle.

Physical meaning of the basic unit of FP is unclear.U bl f i f I/O h Unable to account for new versions of I/O, such as data streams, intelligent message passing, etc.

Not suitable for “complex” software e g real time Not suitable for complex software, e.g., real-time and embedded applications.

[email protected] 88

A Quote from John MunsonA Quote from John Munson“The most important thing we must know about The most important thing we must know about derived metrics is that we cannot add apples and oranges. A new metric simply cannot be derived g p yfrom two or more simple metrics. We recognize this fact in several aspects of our daily life. We do not recognize this fact in our analysis of softwarerecognize this fact in our analysis of software engineering problems. Consider the case of the city of Gold Hill, Colorado. Outside the town there is a ,sign that reads:”

This is really a funny sign. But it isGold Hill

Established 1859

exactly how we define FP!! Elevation 8463

Population 118

Total 10440

[email protected] 89Software Engineering Measurement (by John C. Munson)

Feature PointFeature Point

Page 16: Software Size Metrics: Summary Software Size /1

Feature Point /1Feature Point /1F ti i t i i ll d i d t b li d t Function points were originally designed to be applied to business information systems. Extensions have been suggested called feature pointsfeature points which may enable this gg f pf p ymeasure to be applied to other software engineering applications. F t i t d t li ti i hi h th Feature points accommodate applications in which the “algorithmic complexity” is high such as real-time, process control, and embedded software applications. , pp

For conventional software and information systems functions and feature points produce similar results. For

l t f t i t ft d t b tcomplex systems, feature points often produce counts about %20~%35 higher than function points.

[email protected] 91

Feature Point /2Feature Point /2i l l d h Feature points are calculated the same way as FPs

with the additions of algorithms as an additional f h i isoftware characteristic.

Counts are made for the five FP categories, i.e., number of external inputs, external outputs, inquiries, internal files, external interfaces, plus: Algorithm (Na): A bounded computational problem such

as inverting a matrix, decoding a bit string, or handling an iinterrupt.

[email protected] 92

Feature Point /3Feature Point /3 Feature points are calculated using: Feature points are calculated using:

Number of external inputs 4 Number of external outputs 5 p Number of external inquiries 4 Number of external interface files 7 Number of internal files 7 Algorithms 3

Th UF C d i th f ti i t l l ti t l l t

AILFEIFEQEOEIe NNNNNNCUF 377454

The UFeC used in the function point calculation to calculate the feature points.

[email protected] 93

Object PointObject Pointjj

Object Point /1Object Point /1Obj i d i i i l f i Object points are used as an initial measure for size way early in the development cycle, during f ibili difeasibility studies.

An initial size measure is determined by counting the number of screens, reports, and third-generation components that will be used in the application.

Each object is classified as simple, medium, or difficult. ff

[email protected] 95

Object Point /2Object Point /2O j i i f Object point complexity levels for screens.

Number of viewsNumber of views

Number and source of data tablesNumber and source of data tables

Total <4Total <4 Total <8Total <8 Total 8+Total 8+Number of views Number of views containedcontained

Total 4Total 4<2 servers<2 servers<2 clients<2 clients

Total 8Total 822--3 servers3 servers33--5 clients5 clients

Total 8Total 8>3 servers>3 servers>5 clients>5 clients

< 3 Simple Simple Medium

3 - 7 Simple Medium Difficult

8+ Medium Difficult Difficult

[email protected] 96

Page 17: Software Size Metrics: Summary Software Size /1

Object Point /3Object Point /3O j i i f Object point complexity levels for reports.

Number of viewsNumber of views

Number and source of data tablesNumber and source of data tables

Total <4Total <4 Total <8Total <8 Total 8+Total 8+Number of views Number of views containedcontained

Total 4Total 4<2 servers<2 servers<2 clients<2 clients

Total 8Total 822--3 servers3 servers33--5 clients5 clients

Total 8Total 8>3 servers>3 servers>5 clients>5 clients

0 - 1 Simple Simple Medium

2 - 3 Simple Medium Difficult

4+ Medium Difficult Difficult

[email protected] 97

Object Point /3Object Point /3 The number in each cell is then weighted and summed to get The number in each cell is then weighted and summed to get

the object point. The weights represent the relative effort required to

i l i f h l i l limplement an instance of that complexity level. Complexity level for object point:

Object TypeObject Type SimpleSimple MediumMedium DifficultDifficultScreen 1 2 3 Report 2 5 8

3GL component - - 10

N bj t i t ( bj t i t ) × (100 ) / 100New object points = (object points) × (100 – r) / 100Assuming that % r of the objects will be reused from previous projects.

[email protected] 98

previous projects.

How to Calculate OP?How to Calculate OP?1 Estimate the number of “screens” of the system and the approximate1. Estimate the number of screens of the system and the approximate

number of data entries for each screen (called view). 2. Estimate the number of “reports” that will be generated by the system

(including any output file, writing to database, etc.) and the approximate(including any output file, writing to database, etc.) and the approximate number of data entries for each report (called view).

3. For each “screen” and “report” and their corresponding views, use Tables (previous pages) to determine whether that screen or report is (p p g ) p“simple”, “medium” or “difficult”.

4. Weight the screens and reports using the weight table and sum them up to get the OP number.

5. If you have any acquired component, give it the weight of 10 and add it to the OP.

6. If you have any part of your system reused from a previous generation, d fi t f d th dj t th l f OP di ldefine a percentage of reuse and then adjust the value of OP accordingly.

[email protected] 99

Effort Estimation with OPEffort Estimation with OPF l Formula:

Effort [Person-Month] = OP / PRODHo to meas re PROD? How to measure PROD?

Developer E i /Skill

Very Low Low Average High Very HighExperience/Skills (Nominal)

PROD 4 7 13 25 50

Example:Effort [Person-Month] = 13 / 13 = 1[ ]Assuming average experience and 0% reuse.

Example: OPExample: OP Suppose that you have Suppose that you have

4 screens, 2 of them simple (weight 1) and 2 of them medium (weight 2)3 t 2 f th i l ( i ht 2) d 1 di ( i ht 5) 3 reports, 2 of them simple (weight 2) and 1 medium (weight 5),

then the total number of OP is:OP = 21 + 12 + 22 + 15 = 13OP 21 + 12 + 22 + 15 13

If you have any acquired component, give it the weight 10 and add it to the OP.

If you have any part of your system reused from a previous generation, define a percentage of reuse (say 10%) and then adjust the value of OP accordingly.j g y

OPnew = 13 (100-10)/100 = 11.7

[email protected] 101

Example 2Example 2D t i bj t i t f t di hi Determine object points for a smart vending machine assuming that the system is average size (total number of clients-servers is less than 8) using the following data:) g gScreens Views (Data Items)User Screens

S1. Buying Screen Amount of coins to insert, selection

Administrator ScreensS2. Inventory Update Inventory input update (20 data

items)items)S3. Change Update Change infrared input update (4

data items)

[email protected] 102

Page 18: Software Size Metrics: Summary Software Size /1

Example 2 (cont’d)Example 2 (cont’d)R t Vi (D t It )Reports Views (Data Items)User Reports

R1 Display money entered Amount of money enteredR1. Display money entered Amount of money enteredR2. Not enough money entered Insufficient fundsR3. Returning change Amount of changeR3. Returning change Amount of changeR4. Out of stack message Out of stockR5. No change message No changeR6. Selection Approved Release selection signal

Administrator ReportsR7. Machine Report Inventory (20 data items),

change information (4 data items)

[email protected] 103

items)

Example 2 (cont’d)Example 2 (cont’d)

Simple Medium DifficultS1 S3 S2S1 S3 S2

R1 R2 R3 R4 R5 R6 None R7

OP = (1×1) + (1×2) + (1×3) + (2×6) + (5×0) + (8×1) OP = 26

Effort = 26/13 = 2 person month

[email protected] 104

UseUse--Case PointCase Point

UseUse--Case Point /1Case Point /1F ti P i t i th d t Function Point is a method to measure software size from a requirements perspectiverequirements perspective.

Use-Case is a method to develop requirements Use Cases are usedrequirements. Use Cases are used to validate a proposed design and to ensure it meets all requirements.ensure it meets all requirements.

Question: How to use Use-Cases to measure function point and vice-versa?

[email protected] 106

UseUse--Case Point Case Point /2/2Question: How to use Use-Cases to measure function point and vice-versa?

Two methods:1. Identify and weight actors and use-cases1. Identify and weight actors and use cases2. Count the inputs, outputs, files and data inquiries

from use cases (using the use case definition andfrom use-cases (using the use-case definition and activity diagram).

[email protected] 107

Use Case Point Use Case Point /3/3

Use Case Point Estimation has its origin in the work by Gustav Karner (1993)

Process:1. Identify and weight Actors ( UAW)y g ( )2. Identify and weight Use Cases ( UUCW)3. Calculate Unadjusted Use Case Points ( UUCP = j (

UAW + UUCW)4. Calculate Value Adjustment Factor ( VAF)5. Calculate (Adjusted) Use Case Points UCP = UUCP * VAF

Page 19: Software Size Metrics: Summary Software Size /1

Use Case Point: ActorsUse Case Point: ActorsF h A d i h h h i For each Actor, determine whether the actor is simple, average or complex. A simple actor represents another system with a A simple actor represents another system with a

defined Application Programming Interface (API). [weight: 1]

Actor Use Case

An average actor is either another system that interacts through a protocol (HTTP, FTP, user-defined, etc.), a data store (files, DBs, etc.) or a person interacting through a text-based interface. [weight: 2]

A complex actor is a person interacting through a A complex actor is a person interacting through a graphical user interface (GUI). [weight: 3]

Use Case Point: Use CasesUse Case Point: Use CasesF h U C d t i h th it i For each Use Case, determine whether it is simple, average or complex. A simple use case contains up to 3 transactions. p p

[weight: 5] An average use case contains 4-7 transactions.

[weight: 10]Actor Use Case [we g : 0] A complex use case contains more than 7

transactions. [weight: 15]N t The original Use Case Point method Note: The original Use Case Point method suggested to count only transactions of the main (success) scenarios. Some researchers propose ( ) p pto include in the counting also alternate (extensions) and exception (error) transaction sequencessequences.

Example: ATM Example: ATM A Actors: Visa Cardholder:

l (i t t icomplex (interacts via GUI)

Visa AS: Visa AS: average (interacts via communication protocol)

[email protected] 111

Example: ATM Example: ATM C Use Case:

“Withdraw money i Vi d”using a Visa card”

complex (more than 7 transactions eventransactions, even without counting extensions or

i )exceptions)

UAW = 3 + 2 = 5 UAW = 3 + 2 = 5 UUCW = 15

[email protected] 112

UseUse--Case Point /2Case Point /2h i fil d d We must count the inputs, outputs, files and data

inquiries from use-cases. Function points become evident using the use-case

definition and activity diagram for the use-case. Each step within the activity diagram can be a transaction (inputs, outputs, files and data inquiries).

[email protected] 113

Examining Use Case ScenarioExamining Use Case Scenario

Use Case might be further refined via Activity and Interaction Diagramsy g

Examining Use Case definition and Activity and/or Interaction diagrams can also lead toand/or Interaction diagrams can also lead to FP count.

How?

SENG421 (Winter 2006) [email protected] 114

Page 20: Software Size Metrics: Summary Software Size /1

UseUse--Case DefinitionCase DefinitionA t i l d fi i i d t A typical use-case definition document consists of: Use Case name Actor name Actor Use Case

Objective Preconditions

Use-C

ase

Results (Post-conditions) Detailed description (actions & responses)

Definition

Detailed description (actions & responses) Exceptions and alternative courses

[email protected] 115

UseUse--Case Definition WorksheetCase Definition Worksheet

[email protected] 116

E l A ti it DiE l A ti it DiExample: Activity DiagramExample: Activity DiagramActivityActivity

Decision

Select Course

[ add course ]

Delete Course[ delete course ]

Synchronization Bar (Fork) Concurrent threads

Check Schedule

Check Pre-requisites

Guard Condition Synchronization Bar (Join)(Concurrent thread)

TransitionPre requisites

Assign to course

Resolve conflicts

[ checks completed ] [ checks failed ]

Update schedule

[ student added to the course ]

[email protected] 117

Example 1: UseExample 1: Use--Case ScenarioCase ScenarioUseUse Case:Case: LibraryLibrary But these are not independent from the “Find”UseUse--Case: Case: Library Library ScenarioScenario::1 The user may enter a book’s ISBN number student ID or student

But these are not independent from the Findinput, so they are actually data attributes for “Find”

1. The user may enter a book s ISBN number, student ID, or student name (input 3)

2. The user will press “Find” (input 1)3 If the user enters a book ISBN number (input 1)3. If the user enters a book ISBN number (input 1)

• The system will display information related to that book and write the results to a file (output 1) (internal file 1)

4. If the user entered a student name or student ID (input 2)( p )• The system will return a list of all books on the waiting list for that student

and write the results to a file (output 1) (internal file 1)• The user can select one book from the list (external inquiry 1)• The system will search the database by ISBN number (external file 1)• The system will display information related to that book and available date

and will write the results to a file (output 1) (internal file 1)

[email protected] 118

Together they will qualify as 1 output

Example 2Example 2D X t d t f di l i it i Dr. X, a recent graduate from a medical university, is starting her medical practice in a small town. She is planning to hire a receptionist. She approaches software p g p ppcompany Y to build a software system to manage the patients’ appointments. The following is her problem description (next two slides)description (next two slides).

Suppose that you are the analyst in charge of estimating the cost of this system and you base your estimation of the y y yfunction point (FP) count for this system.

Calculate the unadjusted function point count (UFC) for th t i th i ht f ll t ithe system assuming the average weight for all entries.

[email protected] 119

Example 2 (cont’d)Example 2 (cont’d)Wh ti t ll f i t t th ti i t ill When a patient calls for an appointment, the receptionist will ask the patient’s name or patient’s ID number and will check the calendar and will try to schedule the patient as y pearly as possible to fill in vacancies. If the patient is happy with the proposed appointment, the receptionist will enter the appointment with the patient name and purpose ofthe appointment with the patient name and purpose of appointment. The system will verify the patient name and supply supporting details from the patient records, including the patient’s ID number. After each appointment the Dr. X will mark the appointment as completed, addcomments, and then schedule the patient for the next visit ifcomments, and then schedule the patient for the next visit if appropriate.

outputinput

[email protected] 120

query

Page 21: Software Size Metrics: Summary Software Size /1

Example 2 (cont’d)Example 2 (cont’d)Th ill i b ti t b ti t The system will answer queries by patient name, by patient ID and by date. Supporting details from the patient’s records are displayed along with the appointmentrecords are displayed along with the appointment information. The receptionist can cancel appointments. The receptionist can print out a notification list for making p p greminder calls 2 days before appointments. The system includes the patient’s phone numbers from the patient

d Th ti i t l i t t d il drecords. The receptionist can also print out daily andweekly work schedules with all the patients.

Note that we have to again ask ourselves whether these qualify for EI, EO, EQ, EIF and ILF.

[email protected] 121

Note that we have to again ask ourselves whether these qualify for EI, EO, EQ, EIF and ILF.

Example 2 (cont’d)Example 2 (cont’d)Type Description No. Weight Weighted value

Inputs (EI)Patient name, Patient ID number, Appointment completed, Appointment 5 4 20Inputs (EI) Appointment completed, Appointment purpose, Cancel appointment

5 4 20

Outputs (EO)Comments, Calendar, Supporting details, Appointment Information Notification 7 5 35Outputs (EO) Appointment Information, Notification List, Daily schedule, Weekly schedule,

7 5 35

Queries (EQ)Check calendar, Query by name, Query by ID, Query by date, Verify patient, 6 4 24Queries (EQ) by ID, Query by date, Verify patient, Available Appointment

6 4 24

Internal files (ILF) Patients’ data record 1 10 10( )

External files (EIF) -- 0 7 0

Total UFC 89

[email protected] 122

Total UFC 89

Recent ApproachesRecent Approaches

Recent approaches to size measurement and estimation include: Decomposition Expert opinion Expert opinion Analogy Class-code expansion

[email protected] 123

1. Decomposition1. DecompositionI h i i bl i In many cases, the measurement or estimation problem is too complex to be considered in one piece.

As a result, the measurement or estimation problem is decomposed or partitioned into smaller, more manageable

blproblems. By decomposing the problem, measurement or estimation

b f d i i f hican by performed in a stepwise fashion.

(Remember the GQM technique)(Remember the GQM technique)(Remember the GQM technique)(Remember the GQM technique)

[email protected] 124

2. Expert Opinion /12. Expert Opinion /1Expert opinion refers to predictions made by experts Expert opinion refers to predictions made by experts based on past experience.

The technique is based on combination of individual The technique is based on combination of individual predictions.

The result is a group estimate arrived at by g p yconsensus. The group estimate is typically a better overall estimate than any individual prediction. I l h i i h In general, the expert opinion approach to estimation can result in very accurate estimates, however it is entirely dependent on the experiencehowever it is entirely dependent on the experience of the expert.

[email protected] 125

2. Expert Opinion /22. Expert Opinion /2E lE l Wid b d D l hi T h i Example:Example: Wideband Delphi Technique A group of experts is each given the program’s specifications and an

estimation form. They meet to discuss the product and any estimation issues. They then each anonymously complete the estimation forms The estimates are given to the estimate coordinator who tabulates the The estimates are given to the estimate coordinator, who tabulates the

results and returns them to the experts. Only each expert’s personal estimate is identified; all others are

anonymousanonymous. The experts meet to discuss the results, revising their estimates as

appropriate. The cycle continues until the estimates converge to an acceptable

range.

[email protected] 126

Page 22: Software Size Metrics: Summary Software Size /1

3. Analogy3. AnalogyA l i f l h t t i i l Analogy is a more formal approach to expert opinion also referred to as the Fuzzy-Logic Method or Case-based Method.

Estimators compare the proposed project with one or more past project cases. Differences and similarities are identified

d d t dj t th ti tand used to adjust the estimate. The estimator will typically identify the type of application,

establish an initial prediction and then refine the predictionestablish an initial prediction, and then refine the prediction within the original range.

The accuracy of the analogy approach is dependent on the availability of a case-base of project information.

[email protected] 127

4. Class4. Class––Code ExpansionCode ExpansionI h d i h b d In the design phase, boundary classes are usually expanded by the ratio of 1 to 2 and control

Analysis Classes Descriptionthe ratio of 1 to 2 and control

classes are expanded by the ratio of 2 to 3, respectively. The entity

Boundary class

p y yclasses are usually expanded to a subsystem having 4 to 8 design l

Control class

classes. An average design class in Java

has 20 methods each method

Entity class

has 20 methods, each method having 10 to 20 lines of code.

[email protected] 128

ExampleExample

Using class-code expansionModel Description

: Main

: MaintainProjectData

Boundary class

: User

: ProjectPrompt

: ProjectData

Control class

: User : ProjectData

: ProjectMetrics

: MetricsDatabase

: MaintainProjectMetrics

Entity class

: EnterQuery : RunQuery

[email protected] 129

: QueryResults

Example (cont’d)Example (cont’d)Calculate total software size in LOC assuming total Calculate total software size in LOC, assuming total size is 1.5 × methods LOC

Calculate total development cost Calculate total development cost.Analysis classes No. Total

classesTotal Operations

Total LOC

Boundary class 6 Min 16

Max 29

Min 320

Max 580

1.5 × 320 × 10 = 4,800(minimum)

1 5 × 320 × 20 9 600

min (× 1)max (× 2)

612 1.5 × 320 × 20 = 9,600

1.5 × 580 × 10 = 8,700

( )Control class 3

min (× 2)max (× 3)

69

1.5 × 580 × 20 = 17,400(maximum)

max (× 3) 9Entity class 1

min (× 4) 4

[email protected] 130

max (× 8) 8

Measuring Measuring Measuring Measuring Software ReuseSoftware Reuse

Software Size: Reuse /1Software Size: Reuse /1 Reuse measures how much of a product was copied or Reuse measures how much of a product was copied or

modified. Measurement of size must also include some method of

i d dcounting reused products. It is difficult to define formally what is meant by reused

code. Whole programs can be reused without modification,code. Whole programs can be reused without modification, but it is more common to reuse some part of code (a module, function, or procedure).

The extent of reuse is defined as follows (Software The extent of reuse is defined as follows (Software Productivity Consortium, 1995): Reused verbatim: code in the unit was used without any changes

Sli h l difi d f h 25% f li f d i h i Slightly modified: fewer than 25% of lines of code in the unit were modified

Extensively modified: 25% or more of lines of code were modified N f h d f i l d i

[email protected] 132

New: none of the code comes from a previously constructed unit

Page 23: Software Size Metrics: Summary Software Size /1

Software Size: Reuse /2Software Size: Reuse /2R d it f Reuse needs a repository of reusable componentsR t i

repository

Reuse metrics Reuse Level: percentage of

different items coming from a source source sourcedifferent items coming from a given source in a repository.

Reuse Frequency: percentage of it

q y p greferences to items from a given source in a repository. R D it li d

item item item

Reuse Density: normalized number of items from a given source in a repository.

[email protected] 133

p y

SummarySummaryyy

Software Size: ComparisonSoftware Size: Comparison

Criteria LOC Halstead’s FP OPC ite ia OC alstead s OApplicable to early stages

(requirement phase) of ft d l t?

No No(may be) Yes Yes

software development? ( ay be)

Subjective measure? No No Yes YesDerivable from systemDerivable from system

requirements? No No Yes Yes

Language dependable? Yes Yes No NoHas clear and understandable

physical meaning? Yes No No No

[email protected] 135

Software Size Metrics: Summary Software Size Metrics: Summary Requirement

Length

q

Design

CodeLOCLOC

Software F ti lit

CodeHalstead’sHalstead’s

Function pointFunction point

Feature pointFeature pointSoftware size Functionality Feature pointFeature point

UseUse--case pointcase point

Obj iObj i

Complexity

Object pointObject point

Cyclomatic complexityCyclomatic complexity

Reuse

Reuse levelReuse level

Reuse frequencyReuse frequency

[email protected] 136Reuse densityReuse density

ReferencesReferences[Alb79] A J Alb ht M i li ti D l t P d ti it P [Alb79] A.J. Albrecht: Measuring application Development Productivity, Proc. IBM Application Development Joint SHARE/GUIDE Symposium, pp. 83-92, 1979.

[AlG83] A J Albrecht and J E Gaffney: Software Function Source Lines of [AlG83] A.J. Albrecht, and J.E. Gaffney: Software Function, Source Lines of Code and Development Effort Prediction: A Software Science Validation, IEEE Trans. Software Engineering, 9(6):639-648, 1983.

[Hal77] M. H. Halstead: Elements of Software Science, Operating, and[Hal77] M. H. Halstead: Elements of Software Science, Operating, and Programming Systems Series Volume 7. New York, NY: Elsevier, 1977.

[Jon96] C. Jones: Applied Software Measurement, McGraw-Hill, 1996. [Longstreet] Function Points Analysis Training Manual (110 Pages) (by David [ g ] y g ( g ) ( y

Longstreet, www.SoftwareMetrics.com). [Par92] R. E. Park: Software Size Measurement: A Framework for Counting

Source Statements, Technical Report, CMU/SEI-92-TR-020, 1992. (available at URL: http://www.sei.cmu.edu/pub/documents/92.reports/pdf/tr20.92.pdf)

[email protected] 138