Upcoming SlideShare
Loading in …5
×

# Halsted’s Software Science-An analytical technique

2,288 views

Published on

Published in: Education, Technology
0 Comments
0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

• Be the first to like this

No Downloads
Views
Total views
2,288
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
63
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Halsted’s Software Science-An analytical technique

1. 1. Halsted’s software scienceAn Analytical Technique 1 PREPARED BY- NUR ISLAM Department of Information Technology BESU, SHIBPUR
2. 2. Halstead’s Software Science 2  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: 1. 2. 3. 4. 5. Overall program length Potential minimum volume and Program level Actual volume Effort Development time
3. 3. Important Keywords 3  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
4. 4. Important Keywords 4  Operands in general: A quantity to which an operator is applied – Subroutine declarations – Variable declarations – Variables and constants used with operators in an expression
5. 5. Example 5 2. 1. a=&b • Operands: a , b • Operators : = , & 3. int func (int a, int b) { ... } • Operators: {} , (), “,” func(a, b); • Operators: func, “,” , “;” , “()” • Operands: a , b
6. 6. Halstead’s Software Science 6 • 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
7. 7. Halstead’s Software Science 7  Length and Vocabulary: – Program Length (N)= N1 + N2 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
8. 8. Halstead’s Software Science 8  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
9. 9. Halstead’s Software Science 9 Program volume (V)= is the minimum number of bits needed to encode the program – Program volume V = N log2(η) • To represent η different tokens we need log2(η) 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
10. 10. Halstead’s Software Science 10 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#
11. 11. Halstead’s Software Science 11  Effort and Time: – To obtain the needed effort , we divide the program volume (size) on the program level (complexity) 2 –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
12. 12. Halstead’s Software Science 12  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
13. 13. Halstead’s Software Science 13 • 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 η) r – for an alphabet of size K, there are K strings of length r
14. 14. Halstead’s Software Science 14 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
15. 15. Recap 15  Unique operators  Unique Operands  Total Operators  Total Operands  Program Vocabulary  Program Length  Program Volume  Effort  Time  Estimated Length  Estimated Effort : : : : : : : : : : : η1 η2 N1 N2 η=η1+η2 N=N1+N2 Nlog2η E=V/L T=E/S N=η1log2η1+η2log2η2 E=V.(η1/η2).(N2/2)
16. 16. Example 16 Main() { int a, b, c, avg; scanf(“%d %d %d”, &a, &b, &c); avg = (a +b +c )/3; printf(“avg = %d”, avg); }
17. 17. Example 17 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(η) = 81log2(23) = 366
18. 18. Resources 18 • Wikipedia • Fundamentals of Software Engineering by Rajib Mall, Chapter 3
19. 19. 19