Halsted’s Software Science-An analytical technique

NurIslam5 7,138 views 19 slides Dec 13, 2013
Slide 1
Slide 1 of 19
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19

About This Presentation

No description available for this slideshow.


Slide Content

Prepared By- Nur ISLAm Halsted’s Software Science- An Analytical Technique Department of Information Technology BESU, SHIBPUR 1

Halstead’s Software Science Halstead’s software science is an analytical estimation method . - Have scientific basis Starts with few simple assumptions about the product, Halstead used few primitive program parameters to develop expressions for: Overall program length Potential minimum volume and Program level Actual volume Effort Development time 2

Important Keywords Operator in general : a symbol or function representing a mathematical operation. assignments arithmetic and logical operators Parentheses pair, block begin/end pair If…then… else… endif Do…. While Statement terminator “;” Bitwise operator Pointers operator 3

Important Keywords Operands in general : A quantity to which an operator is applied – Subroutine declarations – Variable declarations – Variables and constants used with operators in an expression 4

Example 1. a=&b • Operands: a , b • Operators : = , & 2. func(a, b); • Operators: func, “,” , “;” , “()” • Operands: a , b 3. int func (int a, int b) { ... } • Operators: {} , (), “,” 5

Halstead’s Software Science • For any giving programs lets define the following parameters: – η1 be the number of unique parameters used in the program – η2 be the number of unique operands used in the program – N1 be the number of the total parameters used in the program – N2 be the number of the total operands used in the program 6

Halstead’s Software Science Length and Vocabulary : – Program Length (N)= N 1 + N 2 This notation agrees with our understanding of the total length of a program as the total count of tokens (operators and operands) – Program Vocabulary (η)= η 1 + η 2 7

Halstead’s Software Science Program Volume : Program volume (V) = is the minimum number of bits needed to encode the program – Program vocabulary and length depends on the programming style – Different lengths of programs, corresponding to the same problem when different languages are used – We need to express the program length by taking the programming language into consideration 8

Halstead’s Software Science Program volume (V) = is the minimum number of bits needed to encode the program – Program volume V = N log 2 ( η ) • To represent η different tokens we need log 2 (η) bits – Example: to represent 8 operands we need 3 bits • For a program of N length, we need N log2(η) bits – Program volume represents the size of the program by approximately compensating the effect of the programming language used 9

Halstead’s Software Science Potential Program Volume (V*) : – V* is the volume of the most concise program in which the problem can be coded – A program require at least 2 operators ( η 1=2) and the required number of operands is η 2 • Example : func() – Therefore: V* = (2+ η2) log2(2+ η2) – Program Level (L) = V*/V – Program level gives an indication of the language level of abstraction – Higher L , higher the language is easier to program with • Example: Assembly vs. C# 10

Halstead’s Software Science Effort and Time : – To obtain the needed effort , we divide the program volume (size) on the program level (complexity) –Effort = E =V / L = V /V* – The programmer’s time needed to finish the program (T) = E / S, where S is the speed of mental discriminations • The recommended value of S is 18 11 2

Halstead’s Software Science Estimation of Length : • Although the program length can be estimated easily using the previous discussed equation N = N1+N2, this can be done before starting the programming activities. • Instead, we can calculate the length depending on the unique numbers of operands and operators 12

Halstead’s Software Science • Halstead assumptions are based on: – Program are unlikely to have several identical parts that are greater than (η) – Identical parts are usually made into procedures and functions – Any program of length N consists of N/η unique strings (of length η) – for an alphabet of size K, there are K strings of length r r 13

Halstead’s Software Science N = η1 log2 (η1) + η2log2(n2) • Experimental evidence showed that the actual and the computed values are very close • Results may be inaccurate when dealing with small programs or subsystems individually 14

Recap 15 Unique operators : η 1 Unique Operands : η 2 Total Operators : N1 Total Operands : N2 Program Vocabulary : η = η 1+ η 2 Program Length : N=N1+N2 Program Volume : Nlog2 η Effort : E=V/L Time : T=E/S Estimated Length : N= η 1log2 η 1+ η 2log2 η 2 Estimated Effort : E=V.( η 1/ η 2).(N2/2)

Example Main() { int a, b, c, avg; scanf(“%d %d %d”, &a, &b, &c); avg = (a +b +c )/3; printf(“avg = %d”, avg); } 16

Example The unique operators are: main, (), {}, int, scanf, &, “, ”, “;”, =, +, /, printf The unique operands are: a, b, c, &a, &b, &c, a +b +c, avg, 3, “%d %d %d”, “avg = %d” therefore η1 = 12, η 2 = 11 N = 12 log2(12)+ 11log2(11) =81 V = Nlog2( η) = 81 log2(23) = 366 17

Resources • Wikipedia • Fundamentals of Software Engineering by Rajib Mall, Chapter 3 18

THANK YOU 19
Tags