Software Design
Software Design
Software Engineering
(Compulsory)
Software Design
Duration: 8 hours
UCSC - 2014 2
IT3205 - Software Design
Learning Objectives
• Describe the important software design issues
and concepts.
• Compare different approaches to software
design.
• Identify suitable design approaches for a
problem.
UCSC - 2014 3
IT3205 - Software Design
Detailed Syllabus
4.1 Design concepts
4.1.1 Abstraction
4.1.2 Architecture
4.1.3 Patterns
4.1.4 Modularity
4.1.4.1 Cohesion
4.1.4.2 Coupling
4.1.5 Information hiding
4.1.6 Functional independence
4.1.7 Refinement
UCSC - 2014 4
IT3205 - Software Design
Detailed Syllabus
4.2 Architectural design
4.2.1 Repository model
4.2.2 Client-server model
4.2.3 Layered model
4.2.4 Modular decomposition
UCSC - 2014 5
IT3205 - Software Design
Detailed Syllabus
4.4 User Interface design
4.4.1. Human-computer interaction
4.4.2. Information presentation
4.4.3. Interface evaluation
UCSC - 2014 6
IT3205 - Software Design
UCSC - 2014 8
IT3205 - Software Design
Design activities
• Identification of the software architecture
• Architectural design
– Identification of the sub systems and components
• Data design
– Organizing the data so as to facilitate effective utilization
• Procedural design
– How inputs are transformed into outputs
• Interface design
– How to make the system user friendly
• Algorithm design
• Design specification
UCSC - 2014 9
IT3205 - Software Design
UCSC - 2014 10
IT3205 - Software Design
Design Concepts
• Abstraction
– Permits one to concentrate on a problem at some level of generalization
without regard to irrelevant low level details
• Stepwise refinement and partitioning
– Increasing level of detail by allocating functionality to modules
• Modularity
– Self contained and loosely coupled software components
• Information Hiding & Encapsulation
– Modules should be specified and designed so that code / data contained in a
module is directly inaccessible to other modules. Protecting information from
direct access by other modules and providing access to this information
through well defined interfaces is called Encapsulation.
• Polymorphism
– Modules should be flexible and promote reusability
UCSC - 2014 11
IT3205 - Software Design
Abstraction
• This is an intellectual tool (a psychological notion)
which permits one to concentrate on a problem at
some level of generalization without regard to
irrelevant low level details
• Abstraction allows us to proceed with the
development work without been held up in low-level
implementation details (yet to be discovered)
• Two forms of abstraction
– Procedural abstraction
– Data abstraction
UCSC - 2014 12
IT3205 - Software Design
Abstraction
Example:
Develop software that will perform 2-D drafting (CAD)
Abstraction 1
Software will include a computer graphics interface which will enable
the draftsperson to see a drawing and to communicate with it via a
mouse. All line and curve drawing, geometric computations will be
performed by the CAD software. Drawing will be stored in a drawings
file.
UCSC - 2014 13
IT3205 - Software Design
Abstraction
Abstraction 2
CAD software tasks:
user interaction task;
2-D drawing task; Procedural Abstraction
graphics display task;
drawing file management task;
End.
UCSC - 2014 14
IT3205 - Software Design
Software Architecture
• Overall structure of the software components
and the ways in which that structure provides
conceptual integrity for a system.
UCSC - 2014 15
IT3205 - Software Design
Design Patterns
• When reusing software components, the developer
is constrained by the design decisions that have been
made by the implementers of these components.
• If the design decisions of the reusable components
conflicts whit the current requirements the
reusability will be impossible or the developed
system will become inefficient.
• One way to solve the problem is to reuse more
abstract designs that do not include implementation
details
UCSC - 2014 16
IT3205 - Software Design
Modularity
• Software is divided into separately named,
addressable components called modules.
• The complexity of a program depends on
modularity.
Let C(x) = a measure of complexity and P1 and P2 be problems,
E(x) = a measure of effort to solve
If C(P1) > C(P2) then
E(P1) > E(P2)
Also, C(P1+P2) > C(P1) + C(P2)
Therefore, E(P1+P2) > E(P1) + E(P2)
UCSC - 2014 17
IT3205 - Software Design
Modularity
• Modularity facilitates
– the development process
– the maintenance process
– the project management process
– reusability
UCSC - 2014 18
IT3205 - Software Design
UCSC - 2014 19
IT3205 - Software Design
Module Coupling
• A measure of the strength of the interconnections
between system components.
• Loose coupling means component changes are likely
to affect other components.
• Shared variables or control information exchange
lead to tight coupling.
• Loose coupling can be achieved by component
communication via parameters or message passing.
UCSC - 2014 20
IT3205 - Software Design
Levels of Coupling
• Data Coupling
– Data is passed from one module to another using arguments
• Stamp Coupling
– More data than necessary is passed via arguments.
Eg. Pass the whole record instead of just the field being changed.
• Control Coupling
– A flag is passed from one module to another affecting the functionality
of the second module
• External Coupling
– Coupling with the environment
(eg. Data files, other programs etc.).
UCSC - 2014 21
IT3205 - Software Design
Levels of Coupling
• Common Coupling
– Occurs when modules access the same global data
MODULE A MODULE B
MODULE C MODULE D
UCSC - 2014 22
IT3205 - Software Design
Levels of Coupling
• Content Coupling
– One module directly affects the working of another. Calling module
can modify the called module or refer to an internally defined data
element.
UCSC - 2014 23
IT3205 - Software Design
Levels of Coupling
• Object Coupling
– Object oriented systems are loosely coupled. No shared state and
objects communicate using message passing. Object coupling occurs
when a class inherits attributes and methods of another class.
Changes to super class propagate to all sub classes.
UCSC - 2014 24
IT3205 - Software Design
Coupling
• Coupling should be minimized.
• Loosely coupled modules facilitate:
– Maintenance
– Development
– Reusability
UCSC - 2014 25
IT3205 - Software Design
Module Cohesion
• Interaction within a module. A measure of
how well a component fits together.
• High cohesion – A component should
implement a single logical entity or function
• Cohesion is a desirable design component
attribute as when a change has to be made, it
is localized in a single component.
UCSC - 2014 26
IT3205 - Software Design
Levels of Cohesion
• Object Cohesion
– Occurs when a single entity is represented by the object and all
operations on the object, and no others are included within it. This is
the strongest type of cohesion and should be aimed by the designer.
• Functional Cohesion
– Occurs when all the elements of the module combine to complete one
specific function. This also strong cohesion and should be
recommended.
• Sequential Cohesion
– Occurs when the activities (more than one purpose to the function)
combine such that the output of one activity is the input to the next.
Not as good as functional cohesion but still acceptable.
UCSC - 2014 27
IT3205 - Software Design
Levels of Cohesion
• Communicational Cohesion
– Occurs when a module performs a number of activities on the same
input or output data.
UCSC - 2014 28
IT3205 - Software Design
Levels of Cohesion
• Procedural Cohesion
– Occurs when a modules’ internal activities bear little relationship to
one another but control flows one to another in sequence.
class MakeCake {
void addIngredients() { ... }
void mix() { ... }
void bake() { ... } }
UCSC - 2014 29
IT3205 - Software Design
Levels of Cohesion
• Temporal Cohesion
– Occurs when functionality is grouped simply because it occurs at the
same time. For example house keeping tasks at the start and end of an
application.
class InitFuns {
void initDisk() { ... }
void initPrinter() { ... }
void initMonitor() { ... } }
UCSC - 2014 30
IT3205 - Software Design
Levels of Cohesion
• Logical Cohesion
– Occurs when functionality is grouped by type. For example all creates
together, all updates together etc. This should be avoided at all cost.
class AreaFuns {
double circleArea() { ... }
double rectangleArea() { ... }
double triangleArea() { ... }}
UCSC - 2014 31
IT3205 - Software Design
Levels of Cohesion
• Coincidental Cohesion
– Occurs when functionality is grouped randomly. Not even to be
considered as an option in design.
class MyFuns {
void initPrinter() { ... }
double calcInterest() { ... }
Date getDate() { ... }}
UCSC - 2014 32
IT3205 - Software Design
Information Hiding
• The principle of Information Hiding suggests that modules be
characterized by design decisions that (each) hides from all others. In
other words modules should be specified and designed so that
information (procedure and data) contained within a module is directly
inaccessible to other modules.
• However the modules should communicates using well defined interfaces.
Protecting information from direct access by other modules and providing
access to this information through well defined interfaces is called
Encapsulation.
• Because most data and procedure are hidden from other parts of the
software, inadvertent errors introduced during modification are less likely
to propagate to other locations within the software.
UCSC - 2014 33
IT3205 - Software Design
Encapsulation
• Encapsulation is a technique for minimizing
interdependencies among separately written
modules by defining strict external interfaces.
• The external interface acts as a contract between a
module and its clients.
• If clients only depend on the interface, modules can
be re-implemented without affecting the client.
• Thus the effects of changes can be confined.
UCSC - 2014 34
IT3205 - Software Design
Functional Independence
• Achieved by developing modules with single-
minded purpose and an aversion to excessive
interaction with other models
UCSC - 2014 35
IT3205 - Software Design
Refinement
• Process of elaboration where the designer
provides successively more detail for each
design component
UCSC - 2014 36
IT3205 - Software Design
UCSC - 2014 37
IT3205 - Software Design
UCSC - 2014 38
IT3205 - Software Design
UCSC - 2014 39
IT3205 - Software Design
UCSC - 2014 40
IT3205 - Software Design
UCSC - 2014 41
IT3205 - Software Design
UCSC - 2014 42
IT3205 - Software Design
UCSC - 2014 44
IT3205 - Software Design
Repository Model
• Sub-systems making up a system must exchange information
so that they can work together effectively. One approach is to
keep all shared data in a central database that can be
accessed by all sub-systems. A system model based on a
shared database is called repository model.
UCSC - 2014 45
IT3205 - Software Design
UCSC - 2014 46
IT3205 - Software Design
UCSC - 2014 47
IT3205 - Software Design
UCSC - 2014 48
IT3205 - Software Design
Client-Server Model
• The client-server architectural model is a distributed system
model which shows how data and processing are distributed
across a range of processors.
• The major components of the model are:
1. A set of stand-alone servers which offer services to other
subsystems. Examples of servers are print servers, web servers and
data base servers.
2. A set of clients that call on the services offered by the servers.
Theses are normally sub-systems in their own right. There may be
several instances of a client program executing concurrently.
3. A network which allows the clients to access these services.
UCSC - 2014 49
IT3205 - Software Design
UCSC - 2014 50
IT3205 - Software Design
Layered Model
• The layered model organizes the system in to layers
by modeling the interfacing of sub systems.
• Each layer provides a set of services.
• This model is also called abstract machine model.
• Each layer defines an abstract machine language is
used to implement the next level of abstract
machine.
UCSC - 2014 51
IT3205 - Software Design
UCSC - 2014 52
IT3205 - Software Design
Layered Model
• An example for layered model is OSI reference model
for network protocols.
• This model support the incremental development of
systems because some of the services provided by
the layer is made available to users while the layer is
being developing.
UCSC - 2014 53
IT3205 - Software Design
Modular Decomposition
• After a structural architecture has been
designed, the next stage of architectural
design process is the decomposition of sub-
system in to modules.
• There is not a rigid distinction between system
decomposition and modular decomposition.
UCSC - 2014 54
IT3205 - Software Design
Modular Decomposition
• We consider two modules which may be used
when decomposing a sub-system into
modules.
1. An object oriented model
• The system decomposed into a set of communicating
objects.
2. A data flow model
• The system decomposed into functional modules which
accept input data and transform it, in some way, to
output data. This is also called a pipeline approach.
UCSC - 2014 55
IT3205 - Software Design
UCSC - 2014 56
IT3205 - Software Design
UCSC - 2014 57
IT3205 - Software Design
UCSC - 2014 58
IT3205 - Software Design
UCSC - 2014 59
IT3205 - Software Design
UCSC - 2014 60
IT3205 - Software Design
UCSC - 2014 61
IT3205 - Software Design
UCSC - 2014 62
IT3205 - Software Design
UCSC - 2014 63
IT3205 - Software Design
UCSC - 2014 64
IT3205 - Software Design
UCSC - 2014 65
IT3205 - Software Design
UCSC - 2014 66
IT3205 - Software Design
UCSC - 2014 67
IT3205 - Software Design
UCSC - 2014 68
IT3205 - Software Design
UCSC - 2014 69
IT3205 - Software Design
• Natural language
– User issues commands in natural language. To delete a file, user may
type ”Delete file name xxx”.
UCSC - 2014 70
IT3205 - Software Design
UCSC - 2014 71
IT3205 - Software Design
UCSC - 2014 72
IT3205 - Software Design
Information Presentation
• All interactive systems have to provide some way of
presenting information to users.
• The information presentation may simply be a direct
representation of the input information or it may present the
information graphically.
• It is a good system design practice to keep software required
for information presentation separate from the information
itself.
• To some extend, this contradicts object-oriented philosophy
which suggest that operation on data should be defined with
the data itself.
UCSC - 2014 73
IT3205 - Software Design
Information Presentation
UCSC - 2014 74
IT3205 - Software Design
Interface Evaluation
• Interface evaluation is the process of
accessing the usability of an interface and
checking that it meets user requirements.
• Systematic evaluation of a user interface
design can be as expensive process involving
cognitive scientist and graphics designers.
• An evaluation should be conducted against a
usability specification based on usability
attributes as shown below.
UCSC - 2014 75
IT3205 - Software Design
Interface Evaluation
Attribute Description
Learn ability How long does it take a new user to
become productive with the system?
Speed of operation How well does the system response to
match the user’s work practices?
Robustness How tolerant is the system of user error?
Recoverability How good is the system at recovering from
user errors?
Adaptability How closely is the system tied to a single
middle of work?
UCSC - 2014 76
IT3205 - Software Design
UCSC - 2014 77
IT3205 - Software Design
Design Notations
• Graphical design notation
– The activity diagram allows a designer to
represent all elements of structured
programming.
– Activity diagram is the descendent of flowchart.
UCSC - 2014 78
IT3205 - Software Design
Design Notations
• Graphical design notation
– Flow chart is simple pictorially
UCSC - 2014 79
IT3205 - Software Design
UCSC - 2014 80
IT3205 - Software Design
UCSC - 2014 81
IT3205 - Software Design
UCSC - 2014 82