Se Unit-3
Se Unit-3
Software Design: Overview of the design process, how to characterize a good software
design? Layered arrangement of modules, Cohesion and Coupling. approaches to software
design.
Agility: Agility and the Cost of Change, Agile Process, Extreme Programming (XP), Other
Agile Process Models, Tool Set for the Agile Process (Text Book 2)
Function-Oriented Software Design: Overview of SA/SD methodology, Structured analysis,
Developing the DFD model of a system, Structured design, Detailed design, and Design
Review.
User Interface Design: Characteristics of a good user interface, Basic concepts, Types of user
interfaces, Fundamentals of component-based GUI development, and user interface design
methodology.
The design process essentially transforms the SRS document into a design document.There
are two fundamentally different approaches to software design that are in use today—
function-oriented design, and object-oriented design. Though these two design approaches
are radically different, they are complementary rather than competing techniques. The
objectoriented approach is a relatively newer technology and it is still evolving.
Function-oriented
The following are the salient features of the function-oriented design approach:
Top-down decomposition: A system, to start with, is viewed as a black box that provides
certain services (also known as high-level functions) to the users of the system. In top-
down decomposition, starting at a high-level view of the system, each high-level function is
successively refined into more detailed functions.
For example, consider a function create-new-library member which essentially creates the
record for a new member, assigns a unique membership number to him, and prints a bill
towards his membership charge. This high-level function may be refined into the following
subfunctions:
• assign-membership-number
• create-member-record
• print-bill
Centralised system state: The system state can be defined as the values of certain data
items that determine the response of the system to a user action or external event.
For example, the set of books (i.e. whether borrowed by different users or available for
issue) determines the state of a library automation system. Such data in procedural
programs usually have global scope and are shared by many modules. The system state is
centralised and shared among different functions.
For example, in the library management system, several functions such as the following
share data such as member-records for reference and updation:
• create-new-member
• delete-member
• update-member-record
Object-oriented Design
In the object-oriented design (OOD) approach, a system is viewed as being made up of a
collection of objects (i.e. entities). Each object is associated with a set of functions that are
called its methods. Each object contains its own data and is responsible for managing it.
The data internal to an object cannot be accessed directly by other objects and only through
invocation of the methods of the object.
ADT is an important concept that forms an important pillar of objectorientation. Let us now
discuss the important concepts behind an ADT. There are, in fact, three important concepts
associated with an ADT—data abstraction, data structure, data type.
Data abstraction:
The principle of data abstraction implies that how data is exactly stored is abstracted away.
This means that any entity external to the object (that is, an instance of an ADT) would
have no knowledge about how data is exactly stored, organised, and manipulated inside the
object. The entities external to the object can access the data internal to an object only by
calling certain well-defined methods supported by the object. Consider an ADT such as a
stack. The data of a stack object may internally be stored in an array, a linearly linked list,
or a bidirectional linked list. The external entities have no knowledge of this and can access
data of a stack object only through the supported operations such as push and pop.
Data structure: A data structure is constructed from a collection of primitive data items.
Just as a civil engineer builds a large civil engineering structure using primitive building
materials such as bricks, iron rods, and cement; a programmer can construct a data structure
as an organised collection of primitive data items such as integer, floating point numbers,
characters, etc.
Data type: A type is a programming language terminology that refers to anything that can
be instantiated. For example, int, float, char etc., are the basic data types supported by C
programming language. Thus, we can say that ADTs are user defined data types. what is the
advantage of developing an application using ADTs?
Let us examine the three main advantages of using ADTs in programs:
1. The data of objects are encapsulated within the methods. The encapsulation
principle is also known as data hiding. The encapsulation principle requires that data
can be accessed and manipulated only through the methods supported by the object
and not directly.
2. An ADT-based design displays high cohesion and low coupling. Therefore, object-
oriented designs are highly modular.
3. Since the principle of abstraction is used, it makes the design solution easily
understandable and helps to manage complexity.
Modularity
A modular design is an effective decomposition of a problem. It is a basic
characteristic of any good design solution. A modular design, in simple words,
implies that the problem has been decomposed into a set of modules that have only
limited interactions with each other. Decomposition of a problem into modules
facilitates taking advantage of the divide and conquer principle. If different modules
have either no interactions or little interactions with each other, then each module
can be understood separately. This reduces the perceived complexity of the design
solution greatly.
For example, consider two alternate design solutions to a problem that are
represented in Figure 5.2, in which the modules M1 , M2 etc. have been drawn as
rectangles. The invocation of a module by another module has been shown as an
arrow. It can easily be seen that the design solution of Figure 5.2(a) would be easier
to understand since the interactions among the different modules is low.
Layered design
A layered design is one in which when the call relations among different modules are
represented graphically, it would result in a tree-like diagram with clear layering. In a
layered design solution, the modules are arranged in a hierarchy of layers. A module can
only invoke functions of the modules in the layer immediately below it. The higher layer
modules can be considered to be similar to managers that invoke (order) the lower layer
modules to get certain tasks done. A layered design can be considered to be implementing
control abstraction, since a module at a lower layer is unaware of (about how to call) the
higher layer modules. A layered design can make the design solution easily understandable,
since to understand the working of a module, one would at best have to understand how the
immediately lower layer modules work without having to worry about the functioning of
the upper layer modules. When a failure is detected while executing a module, it is obvious
that the modules below it can possibly be the source of the error
cohesion method
Cohesion is a measure of the functional strength of a module,If the functions of the module
do very different things and do not co-operate with each other to perform a single piece of
work, then the module has very poor cohesion.
Functional independence
By the term functional independence, we mean that a module performs a single task and
needs very little interaction with other modules. A module that is highly cohesive and also
has low coupling with other modules is said to be functionally independent of the other
modules. Functional independence is a key to any good design primarily due to the
following advantages it offers:
Error isolation: Whenever an error exists in a module, functional independence reduces
the chances of the error propagating to the other modules. The reason behind this is that if a
module is functionally independent, its interaction with other modules is low. Therefore, an
error existing in the module is very unlikely to affect the functioning of other modules.
Further, once a failure is detected, error isolation makes it very easy to locate the error.
Scope of reuse: Reuse of a module for the development of other applications becomes
easier. The reasons for this is as follows. A functionally independent module performs some
well-defined and precise task and the interfaces of the module with other modules are very
few and simple. A functionally independent module can therefore be easily taken out and
reused in a different program.
Understandability: When modules are functionally independent, complexity of the design
is greatly reduced. This is because of the fact that different modules can be understood in
isolation, since the modules are independent of each other.
Classification of Cohesiveness
Cohesiveness of a module is the degree to which the different functions of the module co-
operate to work towards a single objective.The different classes of cohesion are elaborated
below.
Logical cohesion: A module is said to be logically cohesive, if all elements of the module
perform similar operations, such as error handling, data input, data output, etc. As an
example of logical cohesion, consider a module that contains a set of print functions to
generate various types of output reports such as grade sheets, salary slips, annual reports,
etc.
Temporal cohesion: When a module contains functions that are related by the fact that
these functions are executed in the same time span, then the module is said to possess
temporal cohesion. As an example, consider the following situation. When a computer is
booted, several functions need to be performed. These include initialisation of memory and
devices, loading the operating system, etc
Procedural cohesion: A module is said to possess procedural cohesion, if the set of
functions of the module are executed one after the other, though these functions may work
towards entirely different purposes and operate on very different data. Consider the
activities associated with order processing in a trading house. The functions login(), place-
order(), check-order(), printbill(), place-order-on-vendor(), update-inventory(), and logout()
all do different thing and operate on different data.
Communicational cohesion: A module is said to have communicational cohesion, if all
functions of the module refer to or update the same data structure. As an example of
procedural cohesion, consider a module named student in which the different functions in
the module such as admitStudent, enterMarks, printGradeSheet, etc. access and manipulate
data stored in an array named studentRecords defined within the module.
Sequential cohesion: A module is said to possess sequential cohesion, if the different
functions of the module execute in a sequence, and the output from one function is input to
the next in the sequence. As an example consider the following situation. In an on-line store
consider that after a customer requests for some item, it is first determined if the item is in
stock. In this case, if the functions create-order(), check-item-availability(), placeorder-on-
vendor() are placed in a single module
Functional cohesion: A module is said to possess functional cohesion, if different
functions of the module co-operate to complete a single task. For example, a module
containing all the functions required to manage employees’ pay-roll displays functional
cohesion. In this case, all the functions of the module (e.g., computeOvertime(),
computeWorkHours(), computeDeductions(), etc.) work together to generate the payslips of
the employees.
coupling method
Classification of Coupling The coupling between two modules indicates the degree of
interdependence between them. Intuitively, if two modules interchange large amounts of
data, then they are highly interdependent or coupled. The interface complexity is
determined based on the number of parameters and the complexity of the parameters that
are interchanged while one module invokes the functions of the other module.
Object-oriented Design
In the object-oriented design (OOD) approach, a system is viewed as being made up of a
collection of objects (i.e. entities). Each object is associated with a set of functions that are
called its methods. Each object contains its own data and is responsible for managing it.
The data internal to an object cannot be accessed directly by other objects and only through
invocation of the methods of the object. The system state is decentralised since there is no
globally shared data in the system and data is stored in each object. Objects can also be
considered as instances of abstract data types (ADTs) There are, in fact, three important
concepts associated with an ADT—data abstraction, data structure, data type
Data abstraction: The principle of data abstraction implies that how data is exactly stored
is abstracted away. This means that any entity external to the object (that is, an instance of
an ADT) would have no knowledge about how data is exactly stored, organised, and
manipulated inside the object. The entities external to the object can access the data internal
to an object only by calling certain well-defined methods supported by the object.
Data structure: A data structure is constructed from a collection of primitive data items.
Just as a civil engineer builds a large civil engineering structure using primitive building
materials such as bricks, iron rods, and cement; a programmer can construct a data structure
as an organised collection of primitive data items such as integer, floating point numbers,
characters, etc.
Data type: A type is a programming language terminology that refers to anything that can
be instantiated. For example, int, float, char etc., are the basic data types supported by C
programming language. Thus, we can say that ADTs are user defined data types. In object-
orientation, classes are AD
Automated fire-alarm system—customer requirements
The owner of a large multi-storied building wants to have a computerised fire alarm system
designed, developed, and installed in his building. Smoke detectors and fire alarms would
be placed in each room of the building. The fire alarm system would monitor the status of
these smoke detectors. Whenever a fire condition is reported by any of the smoke detectors,
the fire alarm system should determine the location at which the fire has been sensed and
then sound the alarms only in the neighbouring locations. The fire alarm system should also
flash an alarm message on the computer console. Fire fighting personnel would man the
console round the clock. After a fire condition has been successfully handled, the fire alarm
system should support resetting the alarms by the fire fighting personnel.
Function-oriented approach: In this approach, the different high-level functions are first
identified, and then the data structures are designed.
Agility:
Agility means effective (rapid and adaptive) response to change, effective
communication among all stakekholder.
Drawing the customer onto team and organizing a team so that it is in
control of work performed. The Agile process is light-weight methods and
People-based rather than plan-based methods.
The agile process forces the development team to focus on software itself
rather than design and documentation.
The agile process believes in iterative method.
The aim of agile process is to deliver the working model of software quickly
to the customer For example: Extreme programming is the best known of
agile process.
Scrum meetings—are short (typically 15 minutes) meetings held daily by the Scrum team.
Three key questions are asked and answered by all team members.
• What did you do since the last team meeting?
• What obstacles are you encountering?
• What do you plan to accomplish by the next team meeting?
A team leader, called a Scrum master, leads the meeting and assesses theresponses from each
person.
Demos—deliver the software increment to the customer so that functionality thathas been
implemented can be demonstrated and evaluated by the customer.
Dynamic Systems Development Method (DSDM)
• The Dynamic Systems Development Method (DSDM) is an agile
software development approach.
• The DSDM—80 percent of an application can be delivered in 20 percent of
the time it would take to deliver the complete (100 percent) application.
• DSDM is an iterative software process in which each iteration follows the
80 percent rule. That is, only enough work is required for each increment to
facilitate movement to the next increment.
• The remaining detail can be completed later when more business
requirements are known or changes have been requested and
accommodated.
• The activities of DSDM are:
Feasibility study—establishes the basic business requirements and constraintsassociated with the
application to be built and then assesses whether the application is a viable candidate for the
DSDM process.
Business study—establishes the functional and information requirements thatwill allow the
application to provide business value.
Functional model iteration—produces a set of incremental prototypes that
demonstrate functionality for the customer.
• The intent during this iterative cycle is to gather additional requirements by
eliciting feedback from users as they exercise the prototype.
Design and build iteration—prototypes built during functional model
iteration to ensure that each has been engineered in a manner that it will provideoperational
business value for end users.
Implementation—places the latest software increment (an “operationalized” prototype) into the
operational environment. It should be noted that (1) the increment may not be 100 percent
complete or (2) changes may be requested asthe increment is put into place.
Crystal
• Alistair Cockburn and Jim Highsmith created the Crystal family of
agile methods .
• Cockburn characterizes as “a resource limited, cooperative game of
invention and communication, with a primary goal of delivering useful,
working software and a secondary goal of setting up for the next game”.
• Cockburn and Highsmith have defined a set of methodologies, each with
core elements that are common to all, and roles,process patterns, work
products, and practice that are unique to each.
• The Crystal family is actually a set of example agile processes that have
been proven effective for different types of projects.
Feature Driven Development (FDD)
• Feature Driven Development (FDD) was originally coined by Peter Coad
and his colleagues as a process model for object-oriented software
engineering.
• A feature “is a client-valued function that can be implemented in two
weeks or less”.
• the definition of features provides the following benefits:
➢ features are small blocks of deliverable functionality, users can
describe them more easily.
➢ Since a feature is the FDD deliverable software increment, the
team develops operational features every two weeks.
➢ Because features are small, their design and code representations
are easier.
• the following template for defining a feature:
<action> the <result> <by for of to> a(n) <object>
Where
<object> is “a person, place, or thing.”
Examples of features for an e-commerce application might be:
1) Add the product to shopping cart
2) Store the shipping-information for the customer
STRUCTURED ANALYSIS
structured analysis, the major processing tasks (high-level functions) of the system
are analysed, and t h e data flow among these processing tasks are represented
graphically. The structured analysis technique is based on the following underlying
principles: Top-down decomposition approach. Application of divide and conquer
principle. Through this each highlevel function is independently decomposed into
detailed functions. Graphical representation of the analysis results us i ng data flow
diagrams (DFDs). A DFD is a hierarchical graphical model of a system that shows the
different processing activities or functions that the system performs and the data
interchange among those functions
Data Flow Diagrams (DFDs)
The DFD (also known as the bubble chart) is a simple graphical formalism that can be
used to represent a system in terms of the input data to the system, various processing
carried out on those data, and the output data generated by the system. The main reason
why the DFD technique is so popular is probably because of the fact that DFD is a very
simple formalism— it is simple to understand and use.
There are essentially five different types of symbols used for constructing DFDs.
Data dictionary
. A data dictionary lists all data items that appear in a DFD model. The data items listed
include all data flows and the contents of all data stores appearing on all the DFDs in a
DFD model. Please remember that the DFD model of a system typically consists of
several DFDs, viz., level 0 DFD, level 1 DFD, level 2 DFDs, etc.,
The dictionary plays a very important role in any software development process,
A data dictionary provides a standard terminology for all relevant data for use by the
developers working in a project. A consistent vocabulary for data items is very important,
since in large projects different developers of the project have a tendency to use different
terms to refer to the same data, which unnecessarily causes confusion.
Data definition
Composite data items can be defined in terms of primitive data items using the following
data definition operators.
+: denotes composition of two data items, e.g. a+b represents data a and b.
[,,]: represents selection, i.e. any one of the data items listed inside the square bracket
can occur For example, [a,b] represents either a occurs or b occurs.
(): the contents inside the bracket represent optional data which may or may not appear.
a+(b) represents either a or a+b occurs.
{}: represents iterative data definition, e.g. {name}5 represents five name data. {name}*
represents zero or more instances of name data.
=: represents equivalence, e.g. a=b+c means that a is a composite data item
DEVELOPING THE DFD MODEL OF A SYSTEM
The DFD model of a problem consists of many of DFDs and a single data dictionary.
To develop the data flow model of a system, first the most abstract representation Level 0
and Level 1 consist of only one DFD each. Level 2 may contain up to 7 separate DFDs,
and level 3 up to 49 DFDs, and so on. However, there is only a single data dictionary for
the entire DFD model.
Context Diagram
The context diagram is the most abstract (highest level) data flow representation of a
system. It represents the entire system as a single bubble. The bubble in the context
diagram is annotated with the name of the software system being developed (usually a
noun). This is the only bubble in a DFD model, where a noun is used for naming the
bubble.
Level 1 DFD
The level 1 DFD usually contains three to seven bubbles. That is, the system is
represented as performing three to seven important functions. To develop the level 1
DFD, examine the high-level functional requirements in the SRS document. If there are
three to seven highlevel functional requirements, then each of these can be directly
represented as a bubble in the level 1 DFD. Each bubble in the DFD represents a function
performed by the system. The bubbles are decomposed into subfunctions at the
successive levels of the DFD model.
DFD model of a system more systematically.
1. Construction of context diagram:
Examine the SRS document to determine: • Different high-level functions that the system
needs to perform. • Data input to every high-level function. • Data output from every
high-level function. • Interactions (data flow) among the identified high-level functions.
2.Construction of level 1 diagram:
Examine the high-level functions described in the SRS document. If there are three to
seven high-level requirements in the SRS document, then represent each of the high-level
function in the form of a bubble. If there are more than seven bubbles, then some of them
have to be combined. If there are less than three bubbles, then some of these have to be
split.
3.Construction of lower-level diagrams:
Decompose each high-level function into its constituent subfunctions through the
following set of activities: •...Identify the different subfunctions of the high-level
function. •...Identify the data input to each of these subfunctions. •...Identify the data
output from each of these subfunctions. •...Identify he interactions (data flow) among
these subfunctions.
The bubble at the context level is usually assigned the number 0 to indicate that it is the 0
level DFD. Bubbles at level 1 are numbered, 0.1, 0.2, 0.3, etc. When a bubble numbered
x is decomposed, its children bubble are numbered x.1, x.2, x.3, etc
The data that flow into or out of a bubble must match the data flow at the next
level of DFD. This is known as balancing a DFD. In the level 1 DFD, data items d1 and
d3 flow out of the bubble 0.1 and the data item d2 flows into the bubble 0.1 (shown by
the dotted circle). In the next level, bubble 0.1 is decomposed into three DFDs
(0.1.1,0.1.2,0.1.3). The decomposition is balanced, as d1 and d3 flow out of the level 2
diagram and d2 flows in. Please note that dangling arrows (d1,d2,d3) represent the data
flows into or out of a diagram.
Commonly made errors while constructing a DFD model
Although DFDs are simple to understand and draw, students and practitioners
alike encounter similar types of problems while modelling software problems using
DFDs. The errors are as follows:
1. Many beginners commit the mistake of drawing more than one bubble in
the context diagram. Context diagram should depict the system as a single
bubble.
2. Many beginners create DFD models in which external entities appearing at
all levels of DFDs. All external entities interacting with the system should
be represented only in the context diagram. The external entities should not
appear in the DFDs at any other level.
3. It is a common oversight to have either too few or too many bubbles in a
DFD. Only three to seven bubbles per diagram should be allowed. This also
means that each bubble in a DFD should be decomposed three to seven
bubbles in the next level.
4. Many beginners leave the DFDs at the different levels of a DFD model
unbalanced. A common mistake committed by many beginners while
developing a DFD model is attempting to represent control information in a
DFD.
Example 6.1 (RMS Calculating Software) A software system called RMS calculating
software would read three integral numbers from the user in the range of –1000 and
+1000 and would determine the root mean square (RMS) of the three input numbers and
display it. In this example, the context diagram is simple to draw. The system accepts
three integers from the user and returns the result to him.
Example 5
Draw the structure chart for the tic-tac-toe software of Example 6.2. The structure chart
for the Tic-tac-toe software . Observe that the check-game-status bubble, though
produces some outputs. i s not really responsible for converting logical data to physical
data. On the other hand, it carries out the processing involving checking game status.
That is the main reason, why we have considered it as a central transform and not as an
efferent type of module.
Transaction analysis
Transaction analysis is an alternative to transform analysis and is useful while designing
transaction processing programs. A transaction allows the user to perform some specific
type of work by using the software. As in transform analysis, first all data entering into
the DFD need to be identified. In a transaction-driven system, different data items may
pass through different computation paths through the DFD. This is in contrast to a
transform centered system where each data item entering the DFD goes through the same
processing steps. Each different way in which input data is processed is a transaction. For
each identified transaction, trace the input data to the output. All the traversed bubbles
belong to the transaction. These bubbles should be mapped to the same module on the
structure chart. In the structure chart, draw a root module and below this module draw
each identified transaction as a module
Example 6
The structure chart for the personal library software is