Since a lot of people working in software industry come from other than computer science background, I decided to include this chapter in this book. If you ever took any formal course in software engineering, you may skip this chapter.
Contrary to popular belief, software engineering consists of many things other than just coding. In fact coding is only a small part in a typical software project.
In this chapter, I shall discuss various aspects of software engineering in very concise manner to give you an overall idea of the subject. For detail discussion, please consult any standard software-engineering book.
Background of Software Engineering
In earlier times, programming was done in exploratory styles, i.e. every programmers used his/her own development techniques based on personal intuition, experience etc. However, as the size and complexity of the programs increased with time, structured programming technique was developed – which was based on control flow (eg. If – then – else and avoidance of GO TO statements etc.) concept. Though structured programming technique is still widely used nowadays for small and even medium sized applications, large programs are gradually being designed based on Object Oriented Analysis.
Software Life Cycle
A software life cycle is a series of identifiable stages that a software product undergoes during its lifetime. The typical stages are – feasibility study, requirement analysis and specification, design, coding, testing and maintenance.
We shall now briefly discuss each of these steps.
Feasibility study
This is required to find out whether development of the product is technically and financially feasible. This is an overall analysis of the whole problem, possible strategies, cost factor etc.
Requirement Analysis and Specification
The aim of requirement analysis is to understand client/customer’s need thoroughly. Requirement analysis must be carried with due care. It has been found out that much confusion arises at a later stage about what to do exactly because of ambiguous requirement analysis. After the analysis is complete, the requirements are organized in a document known as Software Requirement Specification (SRS). The SRS clearly defines what the software is expected to do (eg. all functionalities, performance issues, input, output etc.) However it need not contain how to do it. The SRS document is normally considered as a contract between client and software development team.
Design
The goal of design is to transform the requirement specifications into a structure that is suitable of implementation some programming languages. The first step in this phase is Structured analysis i.e. preparation of detail analysis of different functions/objects to be used and identification of data flow among various functions/objects. For this purpose, Data Flow Diagrams (DFD) are drawn.
After this, detail design is done. This step involves decomposing the system into various modules/objects and finding relations among them.
Coding
In this phase the design is implemented into codes. Each module is tested individually before integration. This is known as unit testing.
Testing and Integration
In this phase, all modules are combined and integrated. The software is tested as a finished product for all the functionalities. It consists 3 different kinds of testing.
Alpha testing – where the developers test the software.
Beta testing – where some 3rd party test the product and reports the faults/errors etc.
Acceptance testing – is normally done by the client before final delivery of the product.
There are two main approaches for designing test cases – black box testing and white box testing.
In Black Box testing, the test cases are designed based on without any knowledge of internal working of the program. That means, test cases only check whether correct output is found for a specific input. But in White Box
testing, test cases are prepared in such a way so that all logical paths of the program are executed at least once. I shall explain this method with an example.
Consider the program of finding greatest common divisor of two numbers.
Code 16-1
int FindGCD(int x, int y) …… Statement # {
while(x != y) …… 1
{
if(x > y) …… 2
x = x - y; …… 3
else
y = y - x; …… 4
} …… 5
return x; …… 6
}
A Control Flow Diagram (i.e. the sequence by which the statements of a program is executed) of the above code is shown below.
1
2
3 4
5
6
Figure 16-1
The logical paths of code 22-1 are:
1 – 2 – 3 – 5 – 1 – 5 – 6 for this test case x = 4, y = 3 1 – 2 – 4 – 5 – 1 – 5 – 6 for this test case x = 3, y = 4 1 – 5 – 6 for this test case x = 3, y = 3
Maintenance
Statistics shows that more effort is necessary to maintain software than that of developing it! Maintenance is done for correcting errors, improving performance, incorporating new functionalities etc.
Software Development Methodology Models
There are mainly 3 kinds of development methodologies, namely – waterfall model, prototype model and spiral model.
Waterfall model – here all the above-discussed steps (i.e. feasibility study, requirement analysis and specification, design, coding, testing and maintenance) are followed sequentially.
Prototype model – as the name suggests, a prototype or working version of the product is built first for better understanding of the functionality of the project.
If the prototype is thrown away (after gathering information from it) then it is known as ‘Throw away prototype’. However, developers might consider converting the prototype into full working product by adding more and more functionality into it and by successive revisions. In this case, the method is called ‘Evolutionary prototype’.
Spiral model – in this method the main steps followed are 1. Determination of objectives and alternatives
2. Evaluation of alternatives
3. Development of next level of the product 4. Evaluation of the product by the client
These steps are followed iteratively until customer says that the product is ok.
In real life projects, if the methodology to be adopted is completely known in advance (i.e. developers have made similar products in the past), normally waterfall model is followed. For new type of projects, prototype or spiral model is followed. However, in most projects, often a combination of these methods is performed.