Software engineering module 4 notes for btech and mca
mca23mmci43
8 views
93 slides
Mar 12, 2025
Slide 1 of 93
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
About This Presentation
Software engineering
Size: 4.73 MB
Language: en
Added: Mar 12, 2025
Slides: 93 pages
Slide Content
Module 4 SPM
Engineering Activities in Project Lifecycle: Software requirement gathering -Inputs and start criteria, Dimensions, Steps, Output and Quality records, skillsets, Challenges, Metrics for Requirement Phase. Estimation –Three Phases of Estimation, Methodology, Formal models for size estimation, challenges, Metrics for Estimation Process. Design and Development Phases –Features, Reusability, Testability and Maintainability. Project Management in Testing and Maintenance Phases.
DIMENSIONS Stakeholders Interviewing Use case Modelling Facility Application Specification Technique (FAST)
STEPS
Techniques for Requirements Gathering Document analysis Observation Interface Analysis Questionnaires Use Case scenarios Mind Mapping Prototyping
9 Formal Specification Mathematical techniques used include: Logic-based set theoretic algebraic specification finite state machines, etc.
Functional specification using pre-condition and post condition e.g. Module Sort – Sort a list L of integers in ascending order Pre- Condt – non-null L Post- Condt – for all ‘ i ’, 1<= i <= size {L}, L[ i ]<=L[i+1] L=[1,8,7,6,5] L=[3,4,5,6,8] 10
E – Initial State E’ – Final State Input : non null L Output : for all i , 1<= i <size{L’} and L[ i ]<=l’[i+1] and L’=permutation[L] 11
Axiomatic Specifications
Two major components: Syntatic specifications Header Operation Variable Declaration Semantic specifications
Completeness & Consistency Theoretically consistency is difficult to prove. Completeness - Constructors - Extension Operators
Axiomatic Specification of a Stack Operations: Create: Push: Pop: Top:
1. Stack [integer] Header Declare 2. Create() Stack; Constructors 3. Push(stack, integer) Stack; 4. Pop(stack) stack; 5. Top(stack) integer or undefined; Extension Operators Var 6. s: stack ; i : integer ; Variable declaration For all 7. top(create())=undefined; 8. top(push( s,i ))=I; 9. pop(create())=create(); Axioms 10. pop(push( s,i ))=s; end
Axiomatic Specification of a Queue newq: addq: deleteq: emptyq: appendq: frontq:
var 8. q,r : queue; 9. i : item; 10. emptyq ( newq ())=true; 11. emptyq ( addq ( q,i ))=false; 12. frontq ( newq ())=undefined; 13. frontq ( addq ( q,i ))=if emptyq (q) then i else frontq (q) 14. deleteq ( newq ())= newq () 15. deleteq ( addq ( q,i ))= if emptyq (q) then newq () else addq (delete(q), i ); 16. appendq ( q,new ())=q; 17. appendq ( r,addq ( q,i ))= addq ( appendq ( r,q ), i ); end
OUTPUTS SKILL SETS CHALLENGES METRICS 20
2. Estimation –Three Phases of Estimation, Methodology, Formal models for size estimation, challenges, Metrics for Estimation Process. 21
THREE PHASES OF ESTIMATION Effort estimation Cost estimation Resource estimate INPUT – PROJECT SIZE 22
PROJECT SIZE Who estimates? Metrics/Techniques of estimation 23
Methods/Techniques Top Down Bottom Up Three Point Analogous Function point Use case points Wide band Delphi Expert Judgement What if Analysis Monte Carlo Simulation Parametric COCOMO 24
FP=UFP*[0.65+0.01*46] FP=50*1.11=55.5 => 56 1 FP=60 LOC 56 * 60 =3360 LOC FP - Domain Count Weighting Factor Value EI 3 3 9 EO 2 4 8 EQ 2 3 6 ILF 1 7 7 EIF 4 5 20 28
29 COCOMO Model COCOMO ( CO nstructive CO st MO del) proposed by Boehm. Divides software product developments into 3 categories: Organic Semidetached Embedded
30 COCOMO Model (CONT.) Software cost estimation is done through three stages: Basic COCOMO, Intermediate COCOMO, Complete COCOMO.
31 Basic COCOMO Model (CONT.) Gives only an approximate estimation: Effort = a1 (KLOC) a2 Tdev = b1 (Effort) b2 KLOC is the estimated kilo lines of source code, a1,a2,b1,b2 are constants for different categories of software products, Tdev is the estimated time to develop the software in months, Effort estimation is obtained in terms of person months (PMs).
34 Basic COCOMO Model (CONT.) Effort is somewhat super-linear in problem size. Effort Size Embedded Semidetached Organic
35 Example The size of an organic software product has been estimated to be 32,000 lines of source code.
36 Example The size of an organic software product has been estimated to be 32,000 lines of source code. Effort = 2.4*(32) 1.05 = 91 PM Nominal development time = 2.5*(91) 0.38 = 14 months
37 Intermediate COCOMO Basic COCOMO model assumes effort and development time depend on product size alone. However, several parameters affect effort and development time: Reliability requirements Availability of CASE tools and modern facilities to the developers Size of data to be handled
38 Complete COCOMO
39 Complete COCOMO Example A Management Information System (MIS) for an organization having offices at several places across the country: Database part (semi-detached) Graphical User Interface (GUI) part (organic) Communication part (embedded) Costs of the components are estimated separately: summed up to give the overall cost of the system.
40
41
3. Design and Development Phases –Features, Reusability, Testability and Maintainability. 42
Reusability Naming Convention Single responsibility Short sub flows Parameterization Speculative generality 43
44
45
46
Best Practices - Reusability, Maintainability and Scalability 47
4. Project Management in Testing and Maintenance Phases. 48
Statement Coverage The principal idea: unless a statement is executed, we have no way of knowing if an error exists in that statement
Example int f1( int x, int y){ while (x != y){ if (x>y) then x=x-y; else y=y-x; } return x; } Euclid's GCD Algorithm
Euclid's GCD computation algorithm By choosing the test set {(x=3,y=3),(x=4,y=3), (x=3,y=4)} all statements are executed at least once.
Branch Coverage
Example Test cases for branch coverage can be: {(x=3,y=3), (x=4,y=3), (x=3,y=4)}
Condition coverage Consider a Boolean expression having n components: for condition coverage we require 2 n test cases. practical only if n (the number of component conditions) is small.
Path Coverage
Control flow graph (CFG)
How to draw Control flow graph? Number all the statements of a program. Numbered statements: represent nodes of the control flow graph. An edge from one node to another node exists: if execution of the statement representing the first node can result in transfer of control to the other node.
Example Cyclomatic complexity = 7 – 6 + 2 = 3.
Cyclomatic complexity Another way of computing cyclomatic complexity: determine number of bounded areas in the graph Any region enclosed by a nodes and edge sequence. V(G) = Total number of bounded areas + 1
Example From a visual examination of the CFG: the number of bounded areas is 2. cyclomatic complexity = 2+1=3.
Cyclomatic complexity McCabe's metric provides: a quantitative measure of estimating testing difficulty Amenable to automation Intuitively, number of bounded areas increases with the number of decision nodes and loops.
Cyclomatic complexity The cyclomatic complexity of a program provides: a lower bound on the number of test cases to be designed to guarantee coverage of all linearly independent paths.
Cyclomatic complexity Defines the number of independent paths in a program. Provides a lower bound: for the number of test cases for path coverage. only gives an indication of the minimum number of test cases required.
Path testing The tester proposes initial set of test data using his experience and judgement.
An interesting application of cyclomatic complexity Relationship exists between: McCabe's metric the number of errors existing in the code, the time required to find and correct the errors.
Cyclomatic complexity Cyclomatic complexity of a program: also indicates the psychological complexity of a program. difficulty level of understanding the program.
Cyclomatic complexity From maintenance perspective, limit cyclomatic complexity of modules to some reasonable value. Good software development organizations: restrict cyclomatic complexity of functions to a maximum of ten or so.
Euclid’s GCD computation algorithm int f1(int x, int y){ while (x != y){ if (x>y) then x=x-y; else y=y-x; } return x; }
McCabe’s Cyclomatic Complexity int f1(int x, int y){ while (x != y){ if (x>y) then x=x-y; else y=y-x; } return x; }
Example int f1( int x,int y){ while (x != y){ if (x>y) then x=x-y; else y=y-x; } return x; }
Example Control Flow Graph 1 2 3 4 5 6
McCabe's cyclomatic metric Given a control flow graph G, cyclomatic complexity V(G): V(G)= E-N+2 N is the number of nodes in G E is the number of edges in G
Control Flow Graph 1 2 3 4 5 6
Derivation of test cases Number of independent paths: 3 1, 6 test case (x=1, y=1) 1, 2, 3, 5, 1, 6 test case(x=1, y=2) 1, 2, 4, 5, 1, 6 test case(x=2, y=1)
Example-2 (Cyclomatic Complexity)
CFG
Example-3
Data Flow-Based Testing
Data Flow-Based Testing For a statement numbered S, DEF(S) = {X/statement S contains a definition of X} USES(S)= {X/statement S contains a use of X} Example: 1: a=b; DEF(1)={a}, USES(1)={b}. Example: 2: a=a+b; DEF(1)={a}, USES(1)={a,b}.
DU Chain Example 1 X(){ 2 a=5; /* Defines variable a */ 3 While(C1) { 4 if (C2) 5 b=a*a; /*Uses variable a */ 6 a=a-1; /* Defines variable a */ 7 } 8 print(a); } /*Uses variable a */
Project Size Estimation Techniques - Software Engineering – GeeksforGeeks 6 Success What is an Estimation Method? 6 Project Planning Tips [2024] • Asana ful Project Estimation Techniques in 2024 92