Professional Documents
Culture Documents
Prepare by
Zubair Ahmed
S O FT WA R E E N G I N E E R I N G
S O F T WA R E :
S O F T WA R E = Programs + Documentation required to develop, operate and
maintain programs.
Most programmers regard documentation a necessary evil. But this idea is not
correct. In large systems the effort required to write documentation is often as great as that
required to develop programs.
S O F T WA R E E NG I N E E R I N G :
Prepared by Zubair Ahmed -2–
“Over its life time a system is disected, modified and sewn back together
until its form is beyond recognition. Horror stories of these software Frankenstein are well
known to the practitioners.“
Software systems are the most intricate and complex of man’s handiwork
whose complexity increases with size much more than linearly.
We needed:
Better technology.
W E L L E N G I N E E RE D S O F T WA R E :
A well engineered software:
Should be efficient; i.e. it should not make a wasteful use of resources such as
memory & CPU.
S Y S T EM A SS E M BLY FR O M R E - U S A B L E C O M P O N E N T S : This
approach involves developing software system from the existing components. Thus the system
development process becomes one of the assembly rather than creation.
The first three of these approaches are all being used for practical system
development. Some systems have been built using formal transformation but this is still an
untried approach. The re-use-oriented model is still not commercially viable because of the lack
of reusable component libraries.
This model is illustrated in the figure below. Because of the cascade from one
stage to other this model is called waterfall model. This is also called “Classic Life-Cycle”.
This model is the oldest and widely used one.
Requirements
Analysis and
Definition
R E Q USystem N T S A N ALY S I S
I R E M E and A N D D E F I N I T I O N : The system’s
Software Design
services, constraints and goals are established by consultation with the system users. They are
then defined in a manner which is understandable by the users and the development staff.
Implementation
and Unit Testing
Integration and
System Testing
Operation and
Fig. The Waterfall Model of Software Development Maintenance
Prepared by Zubair Ahmed -6–
Software architecture
Interface
Data structure
Procedural details
It is useful for the management if all the stages are distinct. In practice the
stages overlap and feed information to each other. For example, during design problems with
requirements are identified, during coding design problems are found and so on.
Thus the software development process is not a simple linear model but
involves a sequence of iteration of the development activities. But this model makes it difficult
for the management to
Requirements
Analysis and
Definition
System and
Software Design
Implementation
and Unit Testing
Integration and
System Testing
Operation and
Maintenance
During the final phase of life cycle (Operation and Maintenance), the
information is fed back to the previous development phases. In this phase the software is used,
errors and omissions in the requirements phase are discovered, program and design errors come
to light and the need for new functionality is identified. Modifications become necessary for the
software to be useful.
Following are the figures given by Boehm (1975) for different systems:
Prepared by Zubair Ahmed -9–
S Y S T EM T Y P E P H A S E C O S T S (%)
Req / Design Implementation Testing
Space-born Systems 34 20 46
Operating Systems 33 17 50
Scientific Systems44 26 30
Business systems 44 28 28
It is clear that software development costs are more at the beginning & at the
end. Thus the software development costs an be reduced by:
Above figure does not give any information about the maintenance costs.
Again there is an immense variation from system to system. For most large, long life systems
maintenance costs usually exceed the development costs by a factor of 2 to 4. But these may be
greater. The waterfall model is not considered an adequate model because:
This model expects that the requirements be stated explicitly in the beginning.
But this is not possible for the customers.
Customer must have patience. The working programs become available only
at the end of the project. A major mistake, if undetected, can be disastrous.
But in spite of its weaknesses this model is batter than other models.
EXPLORATORY PROGRAMMING
Use Software
Develop System
Outline Spec.
This method requires rapid development of the system & rapid incorporation
of the modifications. To accomplish thus:
Its main difference from the other approaches is in the verification &
validation:
It has been mostly used to develop AI systems & has been little used in the
development of large, long life systems because :
This results in a system whose structure is not well defined and if there is any
it gets deteriorated. Thus the maintenance costs are high (particular when the system maintainers
are different from the system developers).
Coding Program.
The notion that output of one stage acts as input for the other implies that
process is linear. But in actual practice at any point a software engineer considers the earlier and
future stages. A design, which is difficult to implement, is not desired even if it meets the
requirements.
Time required to review the document is significant and a phase starts before
the documents of the previous phase are complete.
Prototype2
Risk
Analysis
Review Prototype1
Request Plan, Simulation, models,
Life Cycle Plan Concept of benchmarks
Operations
S/W
Requirements Detailed
Development Plan Requirements Design
Validation Product
Design
Integration Design
& Test Plan & Verification Implementation
& unit testing
Plan next phase Integration test
Acceptance test
Operation Service
Prepared by Zubair Ahmed - 14 –
Risk cannot be defined precisely. A good way to think of the risk in a model
is simply something, which can go wrong. For example, if the intention is to use a new
programming language a risk is that no suitable compiler is available.
It is not mandatory to adopt a single model for whole of the life cycle of the
system. Spiral model encompasses other process models. Prototyping may be used in one cycle
to resolve the requirements risk and this may be followed by a conventional waterfall model.
Formal transformation can be used for the critical parts of the system and reuse oriented model
can be used during the implementation of the user interface.
The originator of this model, (Boehm) suggests that a form be filled in for
each round of the spiral. To illustrate this a form for the development of “Reusable Components
Catalogue” is shown in the following figure.
Prepared by Zubair Ahmed - 16 –
E X E RC I S E :
Identify two possible risks in each of these strategies and suggest techniques
for risk resolution which would help in deciding which approach to adopt.
Requirements describe a system’s behaviour. These are the services which the
system is expected to provide to the user. The user is not interested in how these services are
implemented so the software engineer should avoid the implementation details in the description
of these requirements.
These set out the constraints under which the system must operate and the
standards, which must be met by the system, e.g. a non-functional constraint might be “input
should be expressible using ASCII character set”. Actually, a non-functional constraint imposes a
restriction, which limits our choice of constructing a solution. A standard, which must be met by
the system, might be “the maximum system response time for any user command should be less
than 2 seconds”.
C HARACTERISTIC S OF R EQUIREMENTS :
They tell the designers what functionality and the characteristics the resultant
system is to have.
They tell the test team what to demonstrate to convince the customer that the
system being delivered is indeed what was ordered. In particular, the standards set out must be
quantifiable measures.
As the requirements are used both by the customer and the system developer,
H OW TO W RITE R EQUIREMENTS
D EFINITION :
It is a normal practice to express the requirements-definition using a mixture
of natural language, tables and diagrams. In spite of the developments in the specification
techniques the first version of the requirements-definition is in a natural language (English or
customer’s language). However, it has become clear that there are several problems with using
natural language. These include:
Requirements are not easily separated according to the system elements with
which they deal. It is sometimes difficult to trace back from a system characteristic to the
requirement that define or affect it.
The most useful approach is to invent a standard format and to ensure that the
definition adheres to that format. The descriptive paragraphs might be followed by a rational and
a reference to more detailed specification.
A X I O M AT I C D E F I N I T I O N :
The system is expressed in terms of axioms. The basic system properties are
specified and the behaviour of the system generates new properties from them. The new
properties are called theorems. This method demands that axioms are complete and consistent
otherwise the resulting theorems will not express truths about the system. This method is well
suited to the requirements definition of the expert systems.
R E Q U I R E M E N T S S P E C I F I C AT I O N :
METHODS FOR W R I T I N G R E Q U I R E M E N T S S P E C I F I C AT I O N S
S T R U C T U R E D L A N G U A G E S P E C I F I C AT I O N :
Function: Check-card-validity
Description: This operation must ensure that the card input by a user has
been issued by the subscribing bank, is in date, contains appropriate account information and
includes the details of date and amount of previous cash withdrawal.
Destination: Auto Teller. The card status is passed to another part of the
software.
Pre-condition: Card has been inserted and data has been read.
and card-status = OK
This specification uses pre and post conditions to specify the actions of the function. It uses a
number of names (Bank-list, Account-format etc.) which must be defined elsewhere in the
specification. This does not include any sequencing information - the tests may be carried out in
any order.
Prepared by Zubair Ahmed - 22 –
This method eliminates some of the problems of natural language specification; i.e. specification
is structured but the ambiguity is still there. The other approaches eliminate this problem at the
expense of readability.
(I) PROTOTYPING:
We need a Prototype to validate the requirements. Sometimes the customer is not certain
what he exactly need. Sometimes customer is certain of what he need but we are not
certain whether the requirements are realistic or not. The potential user may have
difficulty in imagining how the system would work.
Ans: Misunderstandings between the user and the system developers are identified.
A working system is available quickly, which can be used to demonstrate its usefulness
to the management.
Prototype reduces the risk of errors in the requirements, which can be expensive.
It serves as a basis for writing the final version of the requirements specifications.
As it is similar to the actual system, it can be used for staff training (who would
operate the system).
It can be used to run back to back tests with the actual system.
Experiments have shown that prototyping reduces the number of problems with requirement
specifications. Overall development costs may be lower if a prototype is developed.
The potential user may have difficulties in imagining how does the system work. Having only
requirement specification in hand the user may have difficulties in imagining how does the
system would work. One way to counter this difficulty is to develop a system prototype and to
allow the user to experiment with it. In this way user can discover errors and omission in the
requirements.
S TA G E S IN THE P R O T O T Y P E D E V ELO P M E N T :
There are four stages in the prototype development:
User interface
Prepared by Zubair Ahmed - 24 –
Develop requirements
Demonstrate feasibility
3. D E V ELO P PROTOTYPE:
4. E VALUAT E THE PROTOTYPE SYSTEM: User must be given enough training and time
to become comfortable with the system. He should experiment with it and feedback.
Q: How does the prototype development effect the overall cost of a product?
Ans: A common argument against prototyping is that its cost is an unacceptably large fraction
of the total system costs. It may be more economic to modify a finished system to meet
the unperceived needs that to provide the user with the opportunity to refine and
understand his needs. It has been observed that prototype development reduces the overall
cost of a product because:
“Build it cheap and fix it latter” philosophy has failed in case of U.K and U.S
automobile industry while Japanese succeeded due to Prototyping.
P R O T O T Y P I N G T EC H N I Q U E S :
The main objective is the rapid development of a working system (prototype). This minimises
the prototype costs (software staff salaries) and enables early feedback. There are four methods
for Prototype Development:
V ERY H I G H L E V E L L A NG UA G E S (F I F T H G E N E R AT I O N L A N G UA G E S ):
These languages have inherent dynamic data structures and high level features like
Backtracking. These include LISP (LISt Processing - based on list structures), Prolog (PROcess
LOGic - based on logic) APL (A Programming Language - based of vectors) and SETL (SET
language - based on sets). These languages require huge runtime environment and thus are not
suitable for large programs, systems. These are suitable for prototypes or small programs.
Most of these languages are based on a single paradigm (concept), e.g. LISP handles functions
and lists only; Pascal is imperative language; and Prolog is used for facts and logical systems.
LISP and SmallTalk have better environment.
Prepared by Zubair Ahmed - 26 –
Thus, a wide spectrum language like GIST is required, which describes a system as a finite state
model. A wide spectrum language may include objects, logic programming and imperative
constructs. GIST forces us to see the system as a set of “states and actions”. So we can write
specifications in this language. Its commercial derivative REFINE is also available which is
perhaps the wide spectrum language. It is a non-deterministic language in which the user writes
the executable specification. This specification is refined by the user to produce an automated
prototype. The specifications written in GIST or REFINE can be processed to generate programs
in LISP.
An alternative approach is to use mixed language programming for prototype development. Its
disadvantage is communication framework.
F O U RT H G E NE R AT I O N L A NG UA G E S :
COMPOSITION FR O M R EU S A B L E C O M P O N E N T S :
Prototypes can rapidly be created from the reusable components, provided their libraries
are available. Best example of this approach is the Shell programming language available in
several variants under UNIX. It provides facilities for combining commands, which operate on
strings and files: e.g. grip, sat, find. Shell programs are advanced forms of DOS Batch files.
Reusable components can only be used if it was kept in mind before their programming.
Prototyping using the shell is limited because the granularity of software components is
relatively coarse.
Base around database relies on Software reuse where the routines to access database and
generate reports commercial data processing, small, rewrite rather than structuring code of the
prototype, cost affective system specification.
SYSTEM DESIGN
Q: What is a design?
Ans: It is desired to build a new system due to any of the following reasons:
To find a solution to this problem, we use some creative process. The output of this process is a
description of the solution to our problem. This is called system design. There can be more
than one solution to a problem. Design is a creative process. It cannot be learned from book.
Design must be practiced and learnt by experience and study of existing systems.
In system design the functions to be performed by the system are partitioned into Software
Functions and Hardware Functions. Until recently, these decisions were not difficult to make
because only standard hardware with known functionality could be used. As it is now possible to
fabricate special purpose chips at reasonable costs, the borderline between hardware and
software components is blurring. It is becoming increasingly cost effective to delay decisions
about which functions should be implemented in hardware and which functions should be
implemented in software. This implies that system architecture must be made up of stand-alone
components, which can be implemented in either Hardware or Software. This is the aim of the
designer who wants to build a maintainable system. From now onward we shall concentrate on
the software design.
A general model of a software design is a directed graph where the nodes represent the entities
in the design such as processes, functions or types and links represent relations between these
design entities. The target of a design process is the creation of such a graph where there are no
inconsistencies and the relationships are legal ones.
It is not usual for Software designers to arrive at a finished design graph immediately. The design
process appears to be a process of adding formality as the design progresses with constant
backtracking to correct, earlier, less formal design.
hierarchical with cross-links at lower levels. These links appear because of the fact that design
components created earlier are reused later.
Q: What is practiced?
Ans: In many organizations Software design is largely an ad hoc process. Given a set of
requirements, usually in a natural language, an informal design is prepared. Coding then
starts and the design is modified as the system is implemented. By the time the system is
implemented the design has changed so much that its original design document is totally
inadequate description of the system.
Ans: We adopt the later criterion as the criterion of goodness. A maintainable design implies
that cost of system changes should be minimized. This is possible only if the design is
understandable and effects of the changes are local. Let us now investigate the
characteristics of a good design.
1. M O D U L A R I T Y :
Modularity implies decomposition of large system into modules so that each of them can
be implemented independently. A module usually realizes a single and simple function of
the system. It therefore encapsulates data types related to that function & operations on
the data types. In this way changes related to this data type and the corresponding
operations are localized in this module. Each module is provided with a well-defined
interface for communication with the other modules. The interface to the whole system is
structured from these interacting module interfaces. Modularity directly supports
modifiability, reliability and readability.
2. A B S T R AC T I O N :
Prepared by Zubair Ahmed - 29 –
An abstract data type is defined as a set of objects capable only of a certain kind of
behavior which corresponds to a finite set of allowable operations on object of that
type. Its implementation details are hidden. The user is provided with certain operations
and only needs to know what the operations are supposed to do and not how they do it.
3. C O H E S I O N :
It refers to the internal glue with which a module is constructed. A module is highly
cohesive if all elements within the module are directed toward and essential for
performing the same function. The following levels of cohesion (in order of increasing
strength) have been identified.
4. C O U P L I N G :
It is an indication of the strength of interconnections between the program units. It is
measure of how program units depend on each other. Two modules are highly coupled if
there is a great deal of dependence between them.
Prepared by Zubair Ahmed - 30 –
DESIGN ACTIVITIES
A design process consists of a number of stages. These are called design activities. Output of
each design activity is a specification. This specification may be abstract, formal specification,
which is produced to clarify the requirements, or it may be a specification of how part of the
system is to be realized. As the design process continues more and more details is added t the
specification. The design activities and design descriptions (specifications) produced as results of
these activities are illustrated in figure below.
Requirements
Specification
Figure suggests that stages of the design process are sequential. In practice some design activities
go in parallel. However the activities shown are essential in the design of large software systems:
This process is repeated for each subsystem until the components identified can be mapped
directly into programming language components such as packages, procedures or functions.
D E S I G N D E SC R I P T I O N
A design acts as:
There are three notations, which are widely used for the documentation of design:
Generally, all of these notations should be used in describing a system design: Architecture and
logical data design should be described by graphical notation. Design rationale is described
using natural languages (comments) text. The interface design, datastructure design and
Algorithm design are best described using a PDL.
Prepared by Zubair Ahmed - 32 –
A P P R OAC H E S TO S Y S T EM D E S I G N
It is useful to separate a design into component parts called modules. A design module is a
functional entity with a well-defined set of inputs and outputs. Thus each module can be viewed
as a component of the whole system just as each room is a component of a house. A module is
well defined if all the inputs are transformed to generate outputs.
A design is then determination of modules and inter-modular interfaces that satisfy a set of
requirements. These modules can be developed in two ways:
By beginning with a high level view and dividing the system into modules (decomposition).
By beginning with data and objects and building modules from them. (This is called
composition).
Top Level
First Level of
decomposition
2nd Level of
decompositio
Prepared by Zubair Ahmed - 33 –
Object-type
Modules
Object Modules
Data Types
Then we define object-type module or object class to describe a type of data. The result of
building up from data and data types is also a set of modules. Object Oriented design is also
called bottom up design.
Ex: What is common and what is different in function-based design and Object Oriented
design.