SE Module4

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

Module 4

Software Design

Design Principles

1. Should not suffer from “Tunnel Vision” –


While designing the process, it should not suffer from “tunnel vision” which means that
is should not only focus on completing or achievingthe aim but on other effects also.

2. Traceable to analysis model –


The design process should be traceable to the analysis model which means it should
satisfy all the requirements that software requires todevelop a high-quality product.

3. Should not “Reinvent The Wheel” –


The design process should not reinvent the wheel that means it should not waste time
or effort in creating things that already exist.Due to this, the overall development will
get increased.

4. Minimize Intellectual distance –


The design process should reduce the gap between real-world problems and software
solutions for that problem meaning it shouldsimply minimize intellectual distance.

5. Exhibit uniformity and integration –


The design should display uniformity which means it should be uniform throughout the
process without any change. Integration means it should mix or combine all parts of
software i.e. subsystemsinto one system.

6. Accommodate change –
The software should be designed in such a way that it accommodatesthe change implying
that the software should adjust to the change that is required to be done as per the user’s
need.

7. Degrade gently –
The software should be designed in such a way that it degrades
gracefully which means it should work properly even if an error occurs during the
execution.

8. Assessed or quality –
The design should be assessed or evaluated for the quality meaning that during the
evaluation, the quality of the design needs to be checked and focused on.

9. Review to discover errors –


The design should be reviewed which means that the overall evaluation should be done to
check if there is any error present or if itcan be minimized.

10. Design is not coding and coding is not design – Design means describing
the logic of the program to solve anyproblem and coding is a type of language
that is used for the implementation of a design.
Design Concepts

 Abstraction

An abstraction is a tool that enables a designer to consider a componentat an abstract level


without bothering about the internal details of the implementation. Abstraction can be used
for existing element as well asthe component being designed.

Here, there are two common abstraction mechanisms

1. Functional Abstraction
2. Data Abstraction

Functional Abstraction

i. A module is specified by the method it performs.


ii. The details of the algorithm to accomplish the functions are notvisible to the user
of the function.

Functional abstraction forms the basis for Function oriented designapproaches.

Data Abstraction

Details of the data elements are not visible to the users of data. Data Abstraction forms the
basis for Object Oriented design approaches.

 Modularity

Modularity specifies to the division of software into separate modules which are differently
named and addressed and are integrated later on in to obtain the completely functional
software. It is the only property that allows a program to be intellectually manageable. Single
large programs are difficult to understand and read due to a large number of reference
variables, control paths, global variables, etc.

The desirable properties of a modular system are:

o Each module is a well-defined system that can be used with otherapplications.


o Each module has single specified objectives.
o Modules can be separately compiled and saved in the library.
o Modules should be easier to use than to build.
o Modules are simpler from outside than inside.

Advantages of Modularity

There are several advantages of Modularity

o It allows large programs to be written by several or different people


o It encourages the creation of commonly used routines to be placedin the library and
used by other programs.
o It simplifies the overlay procedure of loading a large program into main storage.
o It provides more checkpoints to measure progress.
o It provides a framework for complete testing, more accessible totest
o It produced the well designed and more readable program.

Disadvantages of Modularity

There are several disadvantages of Modularity

o Execution time maybe, but not certainly, longer


o Storage size perhaps, but is not certainly, increased
o Compilation and loading time may be longer
o Inter-module communication problems may be increased
o More linkage required, run-time may be longer, more source lines must be written,
and more documentation has to be done

o Information hiding:

The fundamental of Information hiding suggests that modules can be characterized by the
design decisions that protect from the others, i.e., Inother words, modules should be specified
that data include within a module is inaccessible to other modules that do not need for such
information.
The use of information hiding as design criteria for modular system provides the most
significant benefits when modifications are required during testing's and later during software
maintenance. This is because as most data and procedures are hidden from other parts of the
software, inadvertent errors introduced during modifications are less likely to propagate to
different locations within the software.

o Architecture- design a structure of something Architecture simply means a


technique to design a structure ofsomething. Architecture in designing software
is a concept that
focuses on various elements and the data of the structure. Thesecomponents interact
with each other and use the data of the structure in architecture.

o Refinement- removes impurities


Refinement simply means to refine something to remove any impurities if present
and increase the quality. The refinement concept of software design is actually a
process of developing orpresenting the software or system in a detailed manner that
means to elaborate a system or software. Refinement is very necessary to find out
any error if present and then to reduce it.

o Pattern- a repeated form


The pattern simply means a repeated form or design in which the same shape is
repeated several times to form a pattern. The pattern in the design process means the
repetition of a solution toa common recurring problem within a certain context.

o Refactoring- reconstruct something


Refactoring simply means to reconstruct something in such a waythat it does not
affect the behavior or any other features.
Refactoring in software design means to reconstruct the design to reduce complexity
and simplify it without affecting the behavior orits functions. Fowler has defined
refactoring as “the process of changing a software system in a way that it won’t affect
the behavior of the design and improves the internal structure”.

o Concurrency

Computer has limited resources and they must be utilized efficiently as much as possible. To
utilize these resources efficiently, multiple tasks must be executed concurrently. This
requirement makes concurrency one
of the major concepts of software design. Every system must be designed to allow multiple
processes to execute concurrently, whenever possible. For example, if the current process is
waiting for some event to occur, the system must execute some other process in the mean time.
However, concurrent execution of multiple processes sometimes may result in undesirable
situations such as an inconsistent state, deadlock, etc. For example, consider two processes A
and B and a data item Q1 with the value ‘200’. Further, suppose A and B are being
executedconcurrently and firstly A reads the value of Q1 (which is ‘200’) to add ‘100’ to it.
However, before A updates es the value of Q1, B reads the value ofQ1 (which is still ‘200’)
to add ’50’ to it. In this situation, whether A or B first updates the value of Q1, the value of
would definitely be wrong resulting in an inconsistent state of the system. This is because
the actions of A and B are not synchronized with each other. Thus, the system must control
the concurrent execution and synchronize the actions of concurrent processes.
Effective Modular Design

Any software comprises of many systems which contains several sub- systems and those sub-
systems further contains their sub-systems. So, designing a complete system in one go
comprising of each and every required functionality is a hectic work and the process can have
many errors because of its vast size.
Thus in order to solve this problem the developing team breakdown the complete software
into various modules. A module is defined as the unique and addressable components of the
software which can be solvedand modified independently without disturbing ( or affecting
in very small amount ) other modules of the software. Thus every software design should
follow modularity.
The process of breaking down a software into multiple independent modules where each
module is developed separately is
called Modularization.
Effective modular design can be achieved if the partitioned modules are separately solvable,
modifiable as well as compilable. Here separate compilable modules means that after making
changes in a module thereis no need of recompiling the whole software system.
In order to build a software with effective modular design there is a factor “Functional
Independence” which comes into play. The meaning of Functional Independence is that a
function is atomic in nature so that it performs only a single task of the software without or
with least interaction with other modules. Functional Independence is considered as a sign of
growth in modularity i.e., presence of larger functional independence results in a software
system of good design anddesign further affects the quality of the software.

Benefits of Independent modules/functions in a software design:Since the functionality


of the software have been broken down into atomic levels, thus developers get a clear
requirement of each and everyfunctions and hence designing of the software becomes easy
and error free.
As the modules are independent they have limited or almost no dependency on other modules.
So, making changes in a module without affecting the whole system is possible in this
approach.
Error propagation from one module to another and further in whole system can be neglected
and it saves time during testing and debugging.
Independence of modules of a software system can be measured using 2criteria : Cohesion,
and Coupling. These are explained as following below.
Figure – Cohesion and Coupling between 2 modules
Cohesion:
Cohesion is a measure of strength in relationship between various functions within a module.
It is of 7 types which are listed below in theorder of high to low cohesion:
1. Functional cohesion
2. Sequential cohesion
3. Communicational cohesion
4. Procedural cohesion
5. Temporal cohesion
6. Logical cohesion
7. Co-incidental cohesion

 Functional Cohesion: Every essential element for a single computation is


contained in the component. A functional cohesion performs the task and
functions. It is an ideal situation.
 Sequential Cohesion: An element outputs some data that becomes the input for other
element, i.e., data flow between theparts. It occurs naturally in functional programming
languages.
 Communicational Cohesion: Two elements operate on the same input data or
contribute towards the same output data.Example- update record int the database and
send it to the printer.
 Procedural Cohesion: Elements of procedural cohesion ensurethe order of execution.
Actions are still weakly connected and unlikely to be reusable. Ex- calculate student
GPA, print studentrecord, calculate cumulative GPA, print cumulative GPA.
 Temporal Cohesion: The elements are related by their timing involved. A module
connected with temporal cohesion all the tasks must be executed in the same time-span.
This cohesion contains the code for initializing all the parts of the system. Lotsof different
activities occur, all at init time.
 Logical Cohesion: The elements are logically related and not functionally. Ex- A
component reads inputs from tape, disk, andnetwork. All the code for these functions is
in the same component. Operations are related, but the functions are significantly
different.
 Coincidental Cohesion: The elements are not related(unrelated). The elements have no
conceptual relationship other than location in source code. It is accidental and the worst
form of cohesion. Ex- print next line and reversethe characters of a string in a single
component.

Coupling:
Coupling is a measure of strength in relationship between various modules within a software.
It is of 6 types which are listed below in theorder of low to high coupling:
1. Data Coupling
2. Stamp Coupling
3. Control Coupling
4. External Coupling
5. Common Coupling
6. Content Coupling

 Data Coupling: If the dependency between the modules is based on the fact that they
communicate by passing only data, then the modules are said to be data coupled. In data
coupling,the components are independent to each other and
communicating through data. Module communications don’t
contain tramp data. Example-customer billing system.
 Stamp Coupling In stamp coupling, the complete data structure is passed from one
module to another module. Therefore, it involves tramp data. It may be necessary due
to efficiency factors- this choice made by the insightful designer, not a lazy
programmer.
 Control Coupling: If the modules communicate by passing control information, then
they are said to be control coupled. Itcan be bad if parameters indicate completely
different behaviorand good if parameters allow factoring and reuse of functionality.
Example- sort function that takes comparison function as an argument.
 External Coupling: In external coupling, the modules depend on other modules,
external to the software being developed or to a particular type of hardware. Ex-
protocol, external file, device format, etc.
 Common Coupling: The modules have shared data such as global data structures.The
changes in global data mean tracing back to all modules which access that data to evaluate
the effectof the change. So it has got disadvantages like difficulty in reusing modules,
reduced ability to control data accesses and reduced maintainability.
 Content Coupling: In a content coupling, one module can modify the data of another
module or control flow is passed from one module to the other module. This is the worst
form ofcoupling and should be avoided.
Architectural Design

The software needs the architectural design to represents the designof software.

IEEE defines architectural design as “the process of defining a collection of hardware and
software components and their interfacesto establish the framework for the development of a
computer
system.”

The software that is built for computer-based systems can exhibit one of these many
architectural styles.

Each style will describe a system category that consists of :


 A set of components(eg: a database, computational modules) that will perform a
function required by the system.
 The set of connectors will help in coordination, communication, and cooperation
between the components.
 Conditions that how components can be integrated to form the system.
 Semantic models that help the designer to understand the overallproperties of the system.
Taxonomy of Architectural styles:
1. Data centred architectures:
 A data store will reside at the center of this architecture and is accessed frequently by
the other components that update, add, delete or modify the data present within the
store.
 The figure illustrates a typical data centered style. The client software access a central
repository. Variation of this approach are used to transform the repository into a
blackboard when data related to client or data of interest for the client change the
notifications to client software.
 This data-centered architecture will promote integrability. This means that the existing
components can be changed and new client components can be added to the
architecture without the permission or concern of other clients.
 Data can be passed among clients using blackboardmechanism.
2. Data flow architectures:
 This kind of architecture is used when input data to betransformed into
output data through a series of computational manipulative components.
 The figure represents pipe-and-filter architecture since it usesboth pipe and filter and
it has a set of components called filters connected by pipes.
 Pipes are used to transmit data from one component to thenext.
 Each filter will work independently and is designed to take datainput of a certain form
and produces data output to the next filter of a specified form. The filters don’t require
any knowledge of the working of neighboring filters.
 If the data flow degenerates into a single line of transforms,then it is termed as batch
sequential. This structure acceptsthe batch of data and then applies a series of
sequential components to transform it.
3. Call and Return architectures: It is used to create a program that is easy to scale and
modify. Many sub-styles exist within thiscategory. Two of them are explained below.
 Remote procedure call architecture: This components isused to present in a main
program or sub program architecture distributed among multiple computers on a
network.
 Main program or Subprogram architectures: The main program structure
decomposes into number of subprograms orfunction into a control hierarchy. Main
program contains number of subprograms that can invoke other components.

4. Object Oriented architecture: The components of a systemencapsulate data and the


operations that must be applied to manipulate the data. The coordination and
communication between the components are established via the message passing.
5. Layered architecture:
 A number of different layers are defined with each layer performing a well-defined
set of operations. Each layer will do some operations that becomes closer to machine
instruction set progressively.
 At the outer layer, components will receive the user interfaceoperations and at the
inner layers, components will perform the operating system
interfacing(communication and coordination with OS)
 Intermediate layers to utility services and application software functions.
Component-Level Design

Component-based architecture focuses on the decomposition of the design into individual


functional or logical components that represent well-defined communication interfaces
containing methods, events, and properties.
It provides a higher level of abstraction and divides the problem into sub-problems, each
associated with component partitions.

What is a Component?

A component is a modular, portable, replaceable, and reusable set of well-defined


functionality that encapsulates its implementation and exporting it as a higher-level interface.
A component is a software object, intended to interact with other components, encapsulating
certain functionality or a set offunctionalities. It has an obviously defined interface and
conforms to a recommended behavior common to all components within an architecture.
A software component can be defined as a unit of composition with a contractually specified
interface and explicit context dependencies only. That is, a software component can be
deployed independently and is subject to composition by third parties.

Views of a Component

A component can have three different views − object-oriented view, conventional view, and
process-related view.
Object-oriented view
A component is viewed as a set of one or more cooperating classes. Eachproblem domain
class (analysis) and infrastructure class (design) are explained to identify all attributes and
operations that apply to its implementation. It also involves defining the interfaces that enable
classes to communicate and cooperate.
Conventional view
It is viewed as a functional element or a module of a program that integrates the processing
logic, the internal data structures that are required to implement the processing logic and an
interface that enables the component to be invoked and data to be passed to it.
Process-related view
In this view, instead of creating each component from scratch, thesystem is building from
existing components maintained in a library. As the software architecture is formulated,
components are selected from the library and used to populate the architecture.

Characteristics of Components

 Reusability − Components are usually designed to be reused in different situations in


different applications. However, some components may be designed for a specific
task.
 Replaceable − Components may be freely substituted with other
similar components.
 Not context specific − Components are designed to operate in
different environments and contexts.
 Extensible − A component can be extended from existing
components to provide new behavior.
 Encapsulated − A A component depicts the interfaces, which allowthe caller to use
its functionality, and do not expose details of the internal processes or any internal
variables or state.
 Independent − Components are designed to have minimal
dependencies on other components.

Principles of Component−Based Design

A component-level design can be represented by using some intermediary representation


(e.g. graphical, tabular, or text-based) that can be translated into source code. The design of
data structures, interfaces, and algorithms should conform to well-established guidelines to
help us avoid the introduction of errors.
 The software system is decomposed into reusable, cohesive, and encapsulated
component units.
 Each component has its own interface that specifies required ports and provided ports;
each component hides its detailed implementation.
 A component should be extended without the need to make internal code or design
modifications to the existing parts of the component.
 Depend on abstractions component do not depend on other concrete components,
which increase difficulty in expendability.
 Connectors connected components, specifying and ruling the interaction among
components. The interaction type is specified bythe interfaces of the components.
 Components interaction can take the form of method invocations, asynchronous
invocations, broadcasting, message driven interactions, data stream communications,
and other protocol specific interactions.
 For a server class, specialized interfaces should be created to serve major categories of
clients. Only those operations that are relevant to a particular category of clients should
be specified in the interface.
 A component can extend to other components and still offer its ownextension points.
It is the concept of plug-in based architecture. This allows a plugin to offer another
plugin API.

Component-Level Design Guidelines

Creates a naming conventions for components that are specified as part of the architectural
model and then refines or elaborates as part of the component-level model.
 Attains architectural component names from the problem domain and ensures that they
have meaning to all stakeholders who view the architectural model.
 Extracts the business process entities that can exist independently without any
associated dependency on other entities.
 Recognizes and discover these independent entities as new components.
 Uses infrastructure component names that reflect their implementation-specific
meaning.
 Models any dependencies from left to right and inheritance from top(base class) to
bottom (derived classes).
 Model any component dependencies as interfaces rather than representing them as a
direct component-to-component dependency.

Conducting Component-Level Design

Recognizes all design classes that correspond to the problem domain as defined in the analysis
model and architectural model.
 Recognizes all design classes that correspond to the infrastructure domain.
 Describes all design classes that are not acquired as reusablecomponents, and specifies
message details.
 Identifies appropriate interfaces for each component and elaborates attributes and
defines data types and data structures required to implement them.
 Describes processing flow within each operation in detail by means of pseudo code or
UML activity diagrams.
 Describes persistent data sources (databases and files) and identifies the classes
required to manage them.
 Develop and elaborates behavioral representations for a class or component. This can
be done by elaborating the UML state diagrams created for the analysis model and by
examining all use cases that are relevant to the design class.
 Elaborates deployment diagrams to provide additionalimplementation detail.
 Demonstrates the location of key packages or classes of components in a system by
using class instances and designating specific hardware and operating system
environment.
 The final decision can be made by using established design principles and guidelines.
Experienced designers consider all (or most) of the alternative design solutions before
settling on the finaldesign model.

Advantages

 Ease of deployment − As new compatible versions become available, it is easier to


replace existing versions with no impact on the other components or the system as a
whole.
 Reduced cost − The use of third-party components allows you to spread the cost of
development and maintenance.
 Ease of development − Components implement well-known interfaces to provide
defined functionality, allowing development without impacting other parts of the
system.
 Reusable − The use of reusable components means that they can be used to spread the
development and maintenance cost across several applications or systems.
 Modification of technical complexity − A component modifies the complexity
through the use of a component container and its services.
 Reliability − The overall system reliability increases since the reliability of each
individual component enhances the reliability of the whole system via reuse.
 System maintenance and evolution − Easy to change and update the implementation
without affecting the rest of the system.
 Independent − Independency and flexible connectivity of components. Independent
development of components by different group in parallel. Productivity for the
software development and future software development
User Interface Design

User interface is the front-end application view to which user interacts in order to use the
software. The software becomes morepopular if its user interface is:
 Attractive
 Simple to use
 Responsive in short time
 Clear to understand
 Consistent on all interface screens There are two
types of User Interface:
1. Command Line Interface: Command Line Interface provides acommand prompt, where
the user types the command and feedsto the system. The user needs to remember the
syntax of the command and its use.

CLI Elements

A text-based command line interface can have the following elements:


 Command Prompt - It is text-based notifier that is mostly shows the context in which
the user is working. It is generated by the software system.
 Cursor - It is a small horizontal line or a vertical bar of the heightof line, to represent
position of character while typing. Cursor is mostly found in blinking state. It moves
as the user writes or deletes something.
 Command - A command is an executable instruction. It may have one or more
parameters. Output on command execution is shown inline on the screen. When output
is produced, command prompt isdisplayed on the next line.

2. Graphical User Interface: Graphical User Interface provides the simple interactive
interface to interact with the system. GUI can be a combination of both hardware and
software. Using GUI,user interprets the software.

GUI Elements

GUI provides a set of components to interact with software or hardware.


Every graphical component provides a way to work with the system. AGUI system has
following elements such as:

 Window - An area where contents of application are displayed. Contents in a window


can be displayed in the form of icons or lists, if the window represents file structure.
It is easier for a user to navigate in the file system in an exploring window. Windows
can beminimized, resized or maximized to the size of screen. They can be
moved anywhere on the screen. A window may contain another window of the same
application, called child window.
 Tabs - If an application allows executing multiple instances ofitself, they appear on
the screen as separate windows. Tabbed Document Interface has come up to open
multiple documents in the same window. This interface also helps in viewing
preference panel in application. All modern web-browsers use this feature.
 Menu - Menu is an array of standard commands, grouped together and placed at a
visible place (usually top) inside the application window. The menu can be
programmed to appear or hide onmouse clicks.
 Icon - An icon is small picture representing an associated application. When these
icons are clicked or double clicked, the application window is opened. Icon displays
application and programs installed on a system in the form of small pictures.
 Cursor - Interacting devices such as mouse, touch pad, digital pen are represented in
GUI as cursors. On screen cursor follows the instructions from hardware in almost
real-time. Cursors are also named pointers in GUI systems. They are used to select
menus, windows and other application features.

Application specific GUI components

A GUI of an application contains one or more of the listed GUI elements:


 Application Window - Most application windows uses the constructs supplied by
operating systems but many use their own customer created windows to contain the
contents of application.
 Dialogue Box - It is a child window that contains message for the user and request for
some action to be taken. For Example: Application generate a dialogue to get
confirmation from user to delete a file.
 Text-Box - Provides an area for user to type and enter text-based data.
 Buttons - They imitate real life buttons and are used to submit inputs to the software.

 Radio-button - Displays available options for selection. Only one can be selected
among all offered.
 Check-box - Functions similar to list-box. When an option is selected, the box is
marked as checked. Multiple optionsrepresented by check boxes can be selected.
 List-box - Provides list of available items for selection. More than one item can be
selected.
User Interface Design Activities

There are a number of activities performed for designing user interface. The process of GUI
design and implementation is alike SDLC. Any model can be used for GUI implementation
among Waterfall, Iterative or Spiral Model.
A model used for GUI design and development should fulfill these GUI specific steps.

 GUI Requirement Gathering - The designers may like to have list of all functional
and non-functional requirements of GUI. This can be taken from user and their existing
software solution.
 User Analysis - The designer studies who is going to use the software GUI. The target
audience matters as the design details change according to the knowledge and
competency level of the user. If user is technical savvy, advanced and complex GUI
can be incorporated. For a novice user, more information is included on how-to of
software.
 Task Analysis - Designers have to analyze what task is to be doneby the software
solution. Here in GUI, it does not matter how it willbe done. Tasks can be represented
in hierarchical manner taking one major task and dividing it further into smaller sub-
tasks. Tasksprovide goals for GUI presentation. Flow of information among sub-tasks
determines the flow of GUI contents in the software.
 GUI Design & implementation - Designers after having information about
requirements, tasks and user environment,
design the GUI and implements into code and embed the GUI with working or dummy
software in the background. It is then self- tested by the developers.
 Testing - GUI testing can be done in various ways. Organization can have in-house
inspection, direct involvement of users andrelease of beta version are few of them.
Testing may includeusability, compatibility, user acceptance etc.

User Interface Golden rules

The following rules are mentioned to be the golden rules for GUI design, described by
Shneiderman and Plaisant in their book (Designing the User Interface).
 Strive for consistency - Consistent sequences of actions should be required in similar
situations. Identical terminology should be used in prompts, menus, and help screens.
Consistent commands should be employed throughout.
 Enable frequent users to use short-cuts - The user’s desire to reduce the number of
interactions increases with the frequency of use. Abbreviations, function keys, hidden
commands, and macro facilities are very helpful to an expert user.
 Offer informative feedback - For every operator action, there should be some system
feedback. For frequent and minor actions, the response must be modest, while for
infrequent and majoractions, the response must be more substantial.
 Design dialog to yield closure - Sequences of actions should be organized into groups
with a beginning, middle, and end. Theinformative feedback at the completion of a
group of actions gives the operators the satisfaction of accomplishment, a sense of
relief, the signal to drop contingency plans and options from their minds, and this
indicates that the way ahead is clear to prepare for the next group of actions.
 Offer simple error handling - As much as possible, design the system so the user will
not make a serious error. If an error is made, the system should be able to detect it and
offer simple, comprehensible mechanisms for handling the error.
 Permit easy reversal of actions - This feature relieves anxiety, since the user knows
that errors can be undone. Easy reversal of actions encourages exploration of
unfamiliar options. The units of
reversibility may be a single action, a data entry, or a complete group of actions.
 Support internal locus of control - Experienced operators strongly desire the sense
that they are in charge of the system and that the system responds to their actions.
Design the system to make users the initiators of actions rather than the responders.
 Reduce short-term memory load - The limitation of human information processing
in short-term memory requires the displays to be kept simple, multiple page displays
be consolidated, window- motion frequency be reduced, and sufficient training time
be allotted for codes, mnemonics, and sequences of actions.

You might also like