Unit-3 Sem 6
Unit-3 Sem 6
1
2
Software Design
More creative than analysis
WHAT IS DESIGN
‘HOW’
3
Software Design
Initial requirements
Completed design
Fig. 1 : Design framework
4
Software Design
design
Satisfy
Customer Developers
(Implementers)
5
Software Design
Conceptual Design and Technical Design
D
e
What How
s
Conceptual i Technica
design l
g design
n
A two part
e design System
Customer
process
r Builders
Fig. 2 : A two part design process
6
Software Design
Conceptual design answers :
Where will the data come from ?
What will happen to data in the system?
How will the system look to users?
What choices will be offered to users?
What is the timings of events?
How will the reports & screens look like?
7
Software Design
Technical design describes :
Hardware configuration
Software needs
Communication interfaces I/O
of the system Software
architecture Network
architecture
Any other thing that translates the requirements in to a
solution to the customer’s problem.
8
Software Design
9
Software Design
Informal More
design Informal formal Finished
outline design design
design
10
Software Design
MODULARITY
There are many definitions of the term module. Range is from :
i. Fortran subroutine
ii. Ada package
iii. Procedures & functions of PASCAL & C
iv. C++ / Java classes
v. Java packages
vi. Work assignment for an individual programmer
11
Software Design
12
Software Design
Properties :
i. Well defined subsystem
ii. Well defined purpose
iii. Can be separately compiled and stored in a
library.
iv. Module can use other modules
v. Module should be easier to use than to
build
vi. Simpler from outside than from the inside.
13
Modularity is the single attribute of software that
allows a program to be intellectually manageable.
It enhances design clarity, which in turn
eases
product.
14
Software Design
16
Software Design
17
A Good design will have low coupling. Thus
interfaces should be carefully specified in
order to keep low value of coupling.
18
Software Design
19
Software Design
Consider the example of editing a student record in a
‘student information system’.
Edit student Edit student
record record
Student name,
Student Student Student
student ID,
record ID record
address,
EOF EOF
course
Retrieve Retrieve
student record student record
Poor design: Tight Coupling Good design: Loose Coupling
22
Software Design
Control coupling
Module A and B are said to be control coupled if they
communicate by passing of control information. This is usually
accomplished by means of flags that are set by one module
and reacted upon by the dependent module.
Common coupling
With common coupling, module A and module B have shared
data. Global data areas are commonly found in programming
languages. Making a change to the common data means tracing
back to all the modules which access that data to evaluate the
effect of changes.
23
Software Design
Content coupling
Content coupling occurs when module A changes data of
module B or when control is passed from one module to the
middle of another. In Fig. 9, module B branches into D, even
though D is supposed to be under the control of C.
25
Software Design
External Coupling:
In this, a module has a dependency to other
module,external to the software being developed or
to a particular type of hardware.This is basically
related to the communication to external tools and
devices.
27
Software Design
Module Cohesion
Cohesion is a measure of the degree to t which the
elements of a module are functionally related.
Module
strength
29
Software Design
Types of cohesion
Functional cohesion
Sequential
cohesion
Procedural cohesion
Temporal cohesion
Logical cohesion
Coincident
cohesion
30
Software Design
Functional Cohesion Best (high)
Sequential Cohesion
Communicational Cohesion
Procedural Cohesion
Temporal Cohesion
Logical Cohesion
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.for ex: to
calculate Current GPA and Cumulative GPA
Sequential Cohesion
A outputs some data which forms the input to B. This is the reason
for them to be contained in the same procedure.
32
Software Design
Communicational Cohesion
A and B both operate on the same input data or contribute
towards same output data.
33
Software Design
Procedural Cohesion
Temporal Cohesion
M o d u l e exhibits temporal cohesion when it contains tasks that
are related by the fact that all tasks must be executed in the
same time-span.This is not a good reason to put them in same
procedure.
34
Software Design
Logical Cohesion
Logical cohesion occurs in modules that contain instructions
that appear to be related because they fall into the same logical
class of functions.
Coincidental Cohesion
Coincidental cohesion exists in modules that contain
instructions that have little or no relationship to one another.
In this no conceptual relationship other than shared code.
35
Software Design
Relationship between Cohesion & Coupling
If the software is not properly modularized, a host of seemingly
trivial enhancement or changes will result into death of the project.
Therefore, a software engineer must design the modules with goal of
high cohesion and low coupling.
39
Software Design
Top-Down Design A top down design approach starts by
identifying the major modules of the system
decomposing them into their lower level modules and
iterating until the desired level of detail is achieved.
This is stepwise refinement; starting from an abstrac
design, in each step the design is refined to a more
concrete level, until we reach a level where no more
refinement is needed and the design can be
implemented directly.
This is suitable, if the specifications are clear and development is
from scratch. If coding of a part starts soon after it’s design
nothing can be tested untill all its subordinate modules are coded
40
Software Design
Hybrid Design
For top-down approach to be effective, some bottom-up approach is
essential for the following reasons:
41
Software Design
42
Software Design
43
Software Design
Design Notations
Design notations are largely meant to be used during the process
of design and are used to represent design or design decisions.
For a function oriented design, the design can be represented
graphically or mathematically by the following:
46
Software Design
Structure Chart
It partition a system into black boxes. A black box means that
functionality is known to the user without the knowledge of internal
design.
48
Software Design
A structure chart for “update file” is given in fig. 18.
50
Software Design
A transaction centered structure describes a system that processes a
number of different types of transactions. It is illustrated in Fig.19.
51
Software Design
In the above figure the MAIN module controls the system operation
its functions is to:
52
Software Design
Pseudocode
Pseudocode notation can 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.
53
Software Design
Functional Procedure Layers
Function are built in layers, Additional notation is used
to specify details.
Level 0
Function or procedure name
Relationship to other system components (e.g., part
of which system, called by which routines, etc.)
Brief description of the function purpose.
Author, date
54
Software Design
Level 1
Function Parameters (problem variables, types, purpose,
etc.)
Global variables variable, type, purpose,
(problem sharing
information)
Routines called by the function
Side effects
Input/Output Assertions
55
Software Design
Level 2
Local data structures (variable etc.)
Timing constraints
Exception handling (conditions, responses, events)
Any other limitations
Level 3
Body (structured chart, English pseudo code,
decision tables, flow charts, etc.)
56
Software Design
IEEE Recommended practice for design
software descriptions (IEEE STD 1016-1998)
Scope
An SDD is a representation of a software system that is used as a medium
for communicating software design information.
References
58
Software Design
Purpose of an SDD
The SDD shows how the software system will be structured to
satisfy the requirements identified in the SRS. It is basically the
translation of requirements into a description of the software
structure, software components, interfaces, and data necessary for
the implementation phase. Hence, SDD becomes the blue print for
the implementation activity.
52
59
Software Design
The attributes and associated information items are defined in the
following subsections:
a) Identification f) Dependencies
b) Type g) Interface
c) Purpose h) Resources
d) Function i) Processing
e) Subordinates j) Data
60
Software Design
Design Description Organization
61
Software Design
Cont…
62
Software Design
Table 1:
Organization of
SDD
63
Software Design
Design View Scope Entity attribute Example
representatio
n
Decomposition Partition of the system into Identification, type Hierarchical
description design entities purpose, function, decomposition diagram,
subordinate natural language
65
Software Design
Basic Concepts
Object Oriented Design is not dependent on specific
implementation language. Problems are
modeled Objects have: any objects.
using
Behavior (they do things)
State (which changes when they do things)
66
Software Design
The various terms related to object design are:
i. Objects
67
Software Design
ii. Messages
Objects communicate by message passing. Messages consist of the
identity of the target object, the name of the requested operation and
any other operation needed to perform the function. Message are often
implemented as procedure or function calls.
iii. Abstraction
In object oriented design, complexity is managed using abstraction.
Abstraction is the elimination of the irrelevant and the amplification of
the essentials.It is the method of hiding the unwanted information.
68
Software Design
iv. Class
In any system, there shall be number of objects. Some of the objects
may have common characteristics and we can group the objects
according to these characteristics. This type of grouping is known as a
class. Hence, a class is a set of objects that share a common
structure and a common behavior.
We may define a class “car” and each object that represent a car
becomes an instance of this class. In this class “car”, Indica, Santro,
Maruti, Indigo are instances of this class as shown in fig. 20.
69
Software Design
Fig.20: Indica, Santro, Maruti, Indigo are all instances of the class “car”
70
Software Design
71
Software Design
v. Attributes
An attributes is a data value held by the objects in a class. The square
class has two attributes: a colour and array of points. Each attributes
has a value for each object instance. The attributes are shown as
second part of the class as shown in fig. 21.
vi. Operations
An operation is a function or transformation that may be applied to or
by objects in a class. In the square class, we have two operations: set
colour() and draw(). All objects in a class share the same operations.
An object “knows” its class, and hence the right implementation of the
operation. Operation are shown in the third part of the class as
indicated in fig. 21.
72
Software Design
vii. Inheritance
Imagine that, as well as squares, we have triangle class. Fig. 22 shows
the class for a triangle.
73
Software Design
Now, comparing fig. 21 and 22, we can see that there is some
difference between triangle and squares classes.
For example, at a high level of abstraction, we might want to think of a
picture as made up of shapes and to draw the picture, we draw each
shape in turn. We want to eliminate the irrelevant details: we do not
care that one shape is a square and the other is a triangle as long as
both can draw themselves.
To do this, we consider the important parts out of these classes in to a
new class called Shape. Fig. 23 shows the results.
74
Software Design
77
Software Design
78
Software Design
79
Software Design
i. Create use case model
First step is to identify the actors interacting with the system. We
should then write the use case and draw the use case diagram.
80
Software Design
82
Software Design
83
Software Design
iv. Draw the class diagram
The class diagram shows the relationship amongst classes. There are
four types of relationships in class diagrams.
84
Software Design
b) Dependencies connect two classes. Dependencies are
always unidirectional and show that one class, depends on the
definitions in another class.
85
Software Design
v. Design of state chart diagrams
A state chart diagram is used to show the state space of a given class,
the event that cause a transition from one state to another, and the
action that result from a state change. A state transition diagram for a
“book” in the library system is given in fig. 28.
87
Software Design
A software has to be developed for automating the manual library of a
University. The system should be stand alone in nature. It should be
designed to provide functionality’s as explained below:
Issue of Books:
A student of any course should be able to get books issued.
Books from General Section are issued to all but Book bank books
are issued only for their respective courses.
A limitation is imposed on the number of books a student a
cn
issue.
A maximum of 4 books from Book bank and 3 books o rfm General
section is issued for 15 days only.The software takes the
current system date as the date of issue and calculates date of
return.
88
Software Design
A bar code detector is used to save the student as well as book
information.
The due date for return of the book is stamped on the book.
Return of Books:
Any person can return the issued books.
90
Software Design
91
Software Design
92
Software Design
93
Software Design
94
Software Design
95
Software Design
96
Software Design
97
Software Design
98
Software Design
99
Software Design
10