unit 3_notes_SE
unit 3_notes_SE
3.1Software design
• Design is the highly significant phase in the software development where the
designer plans “how” a software system should be produced in order to make it
functional, reliable and reasonably easy to understand, modify and maintain.
• SRS tell us what a system does and becomes input to design process, which tells us
“how” a software system works.
• Software design involves identifying the component of software design, their inner
workings, and their interface from the SRS. The principle work of this activity is
the software design document (SDD) which is also referred as software design
description
• Software design deals with transforming the customer requirements, as described in
the SRS document, into a form (a set of documents) called software design
document that is suitable for implementation in a programming language.
28
Characteristics and objectives of a good software design
Good design is the key of successful product.
• Correctness: A good design should correctly implement all the functionalities
identified in the SRS document.
• Understandability: A good design is easily understandable.
• Efficiency: It should be efficient.
• Maintainability: It should be easily amenable to change.
29
or related functions . Cohesion is strong if al parts are needed for the functioning of other
parts (e..Important design objective is to maximize module cohesion and minimize module
coupling.
Coupling
It is the measure of the degree of interdependence between modules. Coupling is highly
between components if they depend heavily on one another, (e.g., there is a lot of
communication between them).
Decomposition and modularization
Decomposition and modularization large software in to small independent once, usually
with the goal of placing different functionality or responsibility in different component
Design Complexity
Complexity is another design criteria used in the process of decomposition and refinement.
A module should be simple enough to be regarded as a single unit for purposes of
verification and modification
a measure of complexity for a given module is proportional to the number of other
modules calling this module (termed as fan-in), and the number of modules called by the
given module (termed as fan-out).
Top-down approach (is also known as step-wise design) is essentially the breaking down
of a system to gain insight into its compositional sub-systems. In a top-down approach an
overview of the system is formulated, specifying but not detailing any first-level
subsystems. Each subsystem is then refined in yet greater detail, sometimes in many
additional subsystem levels, until the entire specification is reduced to base elements. A
top-down model is often specified with the assistance of "black boxes", these make it
easier to manipulate. However, black boxes may fail to elucidate elementary mechanisms
or be detailed enough to realistically validate the model.
Bottom-up approach is the piecing together of systems to give rise to grander systems,
thus making the original systems sub-systems of the emergent system. In a bottom-up
approach the individual base elements of the system are first specified in great detail.
These elements are then linked together to form larger subsystems, which then in turn are
linked, sometimes in many levels, until a complete top-level system is formed. This
strategy often resembles a "seed" model, whereby the beginnings are small but eventually
grow in complexity and completeness. However, "organic strategies" may result in a tangle
of elements and subsystems, developed in isolation and subject to local optimization as
opposed to meeting a global purpose. Mechanisms or be detailed enough to realistically
validate the model.
30
• Alternative architectural styles or patterns are analyzed to derive the structure that
is best suited to customer requirements and quality attributes.
• Once an alternative has been selected, the architecture is elaborated using an
architectural design method.
Layered architectures
Data-centered architectures: - A data store (e.g., a file or database) resides at the center
of this architecture and is accessed frequently by other components that update, add, delete,
or otherwise modify data within the store. Client software accesses a central repository. In
some cases the data repository is passive. That is, client software accesses the data
independent of any changes to the data or the actions of other client software. A variation
on this approach transforms the repository into a “blackboard” that sends notifications to
client software when data of interest to the client change.
31
3.4 Coupling and cohesion Measures
Coupling: - It is the measure of the degree of interdependence between modules. Coupling
is highly between components if they depend heavily on one another, (e.g., there is a lot of
communication between them).
Types of Coupling:-
1. Data coupling: communication between modules is accomplished through well-defined
parameter lists consisting of data information items
2. Stamp coupling: Stamp coupling occurs between module A and B when complete data
structure is passed from one module to another.
3. Control coupling: a module controls the flow of control or the logic of another module.
This is accomplished by passing control information items as arguments in the argument
list.
4. Common coupling: modules share common or global data or file structures. This is the
strongest form of coupling both modules depend on the details of the common structure
5. Content coupling: A module is allowed to access or modify the contents of another,
e.g. modify its local or private data items. This the strongest form of coupling
Cohesion :- It is a measure of the degree to which the elements of a module are
functionally related. Cohesion is weak if elements are bundled simply because the perform
similar or related functions. Cohesion is weak if elements are bundled simply because they
perform similar or related functions. Cohesion is strong if al parts are needed for the
functioning of other parts (e..Important design objective is to maximize module cohesion
and minimize module coupling.
Types of Cohesion:-
1.Functional cohesion: A and B are part of a single functional task. This is very good
reason for them to be contained in the same procedure or achieved when the components
of a module cooperate in performing exactly one function, e.g., POLL_SENSORS,
GENERATE_ALARM, etc.
2.Sequential Cohesion: Module A outputs some data which forms the input to B. This is
the reason for them to be contained in the same procedure.
3.Communicational cohesion: is achieved when software units or components of a
module sharing a common information or data structure are grouped in one module
32
4.Procedural cohesion: is the form of cohesion obtained when software components are
grouped in a module to perform a series of functions following a certain procedure
specified by the application requirements
5. Temporal cohesion: Module exhibits temporal cohesion when it contains tasks that are
related by the fact that all tasks must be executed in the same time-span. Examples are
functions required to be activated for a particular input event, or during the same state of
operation
6.Logical cohesion: refers to modules designed using functions who are logically related,
such as input/output functions, communication type functions (such as send and receive),
7.Coincidental cohesion: Coincidental cohesion exists in modules that contain
instructions that have little or no relationship to one another.
33
be used in both the preliminary and detailed design phases. Using pseudocode, the
designer describes system characteristics using short, concise, English language
phrases that are structured by key words such as It-Then-Else, While-Do, and End.
Example:-
COUNT=0
STOCK=STOCK+QUANTITY
OR
READ THE DATA FROM SOURCE
WRITETHE DATA TO DESTINATION
34
Categories of Metrics
i. Product metrics: describe the characteristics of the product such as size,
complexity, design features, performance, efficiency, reliability, portability,
etc.
ii. Process metrics: describe the effectiveness and quality of the processes that
produce the software product. Examples are:
• effort required in the process
• time to produce the product
• effectiveness of defect removal during development
• number of defects found during testing
• maturity of the process
iii. Project metrics: describe the project characteristics and execution.
Examples are:-
• number of software developers
• staffing pattern over the life cycle of the software
• cost and schedule
• productivity
Volume
• The unit of measurement of volume is the common unit for size “bits”. It is the actual
size of a program if uniform binary encoding for the vocabulary is used.
V= N* log2 ή
Program Level
• The value of L ranges between zero and one, with L=1 representing a program
written at the highest possible level (i.e., with minimum size) and v is the potential
volume
35
L=V*/V
Estimated program Length
• Advantages
– Users point of view: what user requests & receives from the system
– Independent of tech.,lang,tool,methods
36
– Can be estimated from SRS or Design specification Doc.
– Since directly from first phase doc. So easy re-estimation on expansion or
modification.
• Disadvantages
– Difficult to estimate
– Experienced based/subjective
3.8 Coding styles- Coding guidelines provide only general suggestions regarding the
coding style to be followed.
1) Do not use a coding style that is too clever or too difficult to understand- Code
should be easy to understand. Clever coding can obscure meaning of the code and
hamper understanding. It also makes maintenance difficult.
2) Avoid obscure side effects- The side effects of a function call include modification
of parameters passed by reference, modification of global variables, and I/O
operations. An obscure side effect is one that is not obvious from a casual
examination of the code. Obscure side effects make it difficult to understand a
piece of code.
3) Does not use an identifier for multiple purposes- Programmers often use the
same identifier to denote several temporary entities? There are several things which
are wrong with this approach and hence should be avoided. Some of the problems
caused by use of variables for multiple purposes are as follows:
Ø Each variable should be given a descriptive name indicating its purpose.
This is not possible if an identifier is used for multiple purposes. Use of a
variable for multiple purposes can lead to confusion and make it difficult to
read and understand the code.
Ø Use of variables for multiple purposes usually makes future enhancements
more difficult.
4) The code should be well-documented- As a rule of thumb, there must be at least
one comment line on the average for every three source lines.
5) Do not use goto statements- Use of goto statements makes a program unstructured
and very difficult to understand.
37