You are on page 1of 32

UNIT-4 Software Design, Coding and Testing 1

Software Design , Coding and Testing: Good software design, Cohesion and Coupling, Software Design
Approaches, User interface Design, Software Coding and Goals of UML - Role of UML in Object oriented Design -
Building blocks of UML : Things, Relationships, and Diagrams - Symbols used in UML notation - Classify and
list standard UML diagrams - Class diagram, purposes of class diagram, draw the class diagram - Use case diagram,
define the term Use case, purposes of Use case diagram, draw the Use case diagram - Interaction diagram,
purposes of Interaction diagram, the types of interaction diagrams : Sequence diagram and Collaboration
diagram, draw the Interaction diagrams.
-----------------------------------------------------------------------------------------------------------------------------------------------------

Q.What is the Software design process?


The activities carried out during the design phase (called as design process) transform the SRS document into the
design document.
The design process starts using the SRS document and completes with the production of the design document.
The design document produced at the end of the design phase should be implementable using a programming
langu

Overview of the design process:


1 Outcome of the Design Process:The following items are designed and documented during the design phase.
A.Different modules required: The different modules in the solution should be identified.
Each module is a collection of functions and the data.
Each module should accomplish some well-defined task .
Each module should be named according to the task it performs.
For example, in an academic automation software, the module consisting of the functions and data perform task
of registration of the students should be named handle student registration.
B)Control relationships among modules: The control relationships existing among various modules should be
identified in the design document.
Interfaces among different modules: The interfaces between two modules identifies the exact data items that
are exchanged between the two modules when one module invokes a function of the other module.
Data structures of the individual modules:Suitable data structures for storing and managing the data of a module
need to be properly designed and documented.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 2

Algorithms required to implement the individual modules:


The algorithms required to accomplish the processing activities of various modules need to be carefully designed
and documented with due considerations given to the accuracy of the results, space and time complexities
Classification of Design Activities
iterating over a series of steps called the design activities.
Design Activitiescan broadly classify them into two important stages.
„ Preliminary (or high-level) design, and
„ Detailed design.
Preliminary (High-Level) Design

High-level design means identification of different modules and the control relationships among them and the
definition of the interfaces among these modules. The outcome of the high-level design is called software
architecture or the program structure. Many different types of notations have been used to represent a high-
level design. A popular way is to use a tree-like diagram called the Structure Chart to represent the control
hierarchy in the high-level design.

Detailed Design

During detailed design, the data structure and the algorithms of the different modules are designed. The outcome
of the detailed design stage is usually known as the module-specification document

How can we characterize a good software design? ( M)

The definition of a“good” software design can vary depending on the exact application being designed. For
example, “memory size used up by a program” may be an important way to characterizea good solution for
embedded software development
Most researchers and software engineers agree on a few desirable characteristics that every good software
design for general applications must possess. These characteristics are listed below:
Correctness:A good design should correctly implement all the functionalities identified in the SRS document.
Understand ability: A good design should be easily understandable. Unless a design solution is easily
understandable, it would be difficult to implement and maintain it.
efficiency: A good design solution should adequately address resource, time, and cost optimization issues.
Maintainability: A good design should be easy to change. This is an important requirement,
since change requests usually keep coming from the customer even after product release.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 3

Cohesion and Coupling


Cohesion:Cohesion is a measure of the functional strength of a module.In computer programming, cohesion is
an indication that shows the relationship within modules. Cohesion provides the information about the functional
strength of the modules. The greater the cohesion, the better will be the program design.
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 cohesiveness increases from coincidental to functional cohesion. That is,
coincidental is the worst type of cohesion and functional is the best cohesion possible. These different classes of
cohesion are elaborated below.
7 6 5 4 3 2 1

,
1.Coincidental cohesion: A module which performs a set of tasks that relate to each other very loosely called’’
Coincidental cohesion’’.. An example of a module with coincidental cohesion has been Observe that the
different functions of the module carry out very different and unrelated activities starting from issuing of library
books to creating library member records on one hand, and handling librarian leave request on the other.

2. Logical cohesion: A module which performs logical related tasks(operations, such as error handling, data
input, data output, etc.) is called logical cohesive. As an example of logical cohesion, consider amodule that
contains a set of print functions to generate various types of output reports such as grade sheets,salary slips,
annual reports, etc.
3.Temporal cohesion: A module which all the 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 such asinitialization of memory and devices, loading the operating system,
or start-up, or shut-down of some process.

4.Procedural cohesion: A module is said to possess procedural cohesion, if the set of


functions of the module are executed one after the other(I.e specific procedure order) is called Procedural
cohesion. Consider the activities associated with order processing in a trading house. The functions login(),
place-order(), check-order(), print-bill(), place-order-on-vendor(), updateinventory(), and logout() all do different
thing and operate on different data. However,Software Design they are normally executed one after the other
during typical order processing by a sales clerk.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 4

5.communication cohesion:A module is said to have communication cohesion, if all functions of the module
refer to or update the same data structure.same input data or contribute towards the same output data.
Example- update record int the database and send it to the printer.
6. 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 function in the sequence manner. 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 itemis in stock. In this case, if the functions create-order(), check-item-
availability(),place-order-on-vendor() are placed in a single module, then the module would exhibit sequential
cohesion. Observe that the function create-order() creates an order that is processed by the function check-item-
availability() (whether the items are available in the required quantities in the inventory) is input to place-order-
on-vendor().
7.Functional Cohesion: Functional Cohesion is said to exist if the 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.
Another example of a module possessing functional cohesion has been shown in In this example, the functions
issue-book(), return-book(), query-book(), and find-borrower(), together manage all activities concerned with
book lending.

Coupling:coupling between two modules is a measure of the degree of interaction (or interdependence) between
the two modules.
Data coupling: Two modules are data coupled, if they communicate using an elementary data item that is
passed as a parameter between the two, e.g. an integer, a flfloat, a character, etc. This data item should be
problem related and not used for control purposes.
Stamp coupling: Two modules are stamp coupled, if they communicate using a composite data item such as a
record in PASCAL or a structure in C.
Control coupling: Control coupling exists between two modules, if data from one module is used to direct the
order of instruction execution in another. An example of control coupling is a flflag set in one module and tested
in another module.
Common coupling: Two modules are common coupled, if they share some global data items.
Content coupling: Content coupling exists between two modules, if they share code. That is, a jump from one
module into the code of another module can occur. Modern high-level programming languages such as C do not
support such jumps across modules. The different types of coupling are shown schematically in Figure 5.5. The
degree of coupling increases from data coupling to content coupling. High coupling among modules not only

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 5

makes a design solution difficult to understand and maintain, but it also increases development effffort and also
makes it very difficult to get these modules developed independently by difffferent team members.

APPROACHES TO SOFTWARE DESIGN


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 object-oriented approach is a relatively newer technology and is still evolving. For
development of large programs, the object-oriented approach is becoming increasingly popular due to certain
advantages that it offers. On the other hand, function oriented designing is a mature technology .

Function-oriented Design
The following are the salient features of the function oriented design approach:
Top-down decomposition: 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 sub functions:
create-new-library member - HL Functions„
 assign-membership-number
 create-member-record Sub functions:
 print-bill
Each of these sub functions may be split into more detailed sub functions and so on.
Centralized 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.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

2.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.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 6

For example, in a library automation software, each library member may be a separate object with its own data and
functions to operate on the stored data. The methods defined for one object cannot
directly refer to or change the data of other objects.
There 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, organized, and
manipulated inside 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

Object-oriented versus function-oriented design approaches


The following are some of the important differences between the function-oriented and
object-oriented design:
„. Unlike function-oriented design methods in OOD, the basic abstraction is not the services available to the users of the
system such as issue-book, display-bookdetails, find-issued-books, etc., but real-world entities such as member, book,
book-register, etc. For example in OOD, an employee pay-roll software is notdeveloped by designing functions such as
update-employee-record, get-employeeaddress,etc., but by designing objects such as employees, departments, etc.
„. In OOD, state information exists in the form of data distributed among severalobjects of the system. In contrast, in a
procedural design, the state informationis available in a centralised shared data store. For example, while developing
anemployee pay-roll system, the employee data such as the names of the employees,their code numbers, basic salaries, etc.,
are usually implemented as global data in atraditional programming system; whereas in an object-oriented design, these
data aredistributed among different employee objects of the system. Objects communicate bymessage passing. Therefore,
one object may discover the state information of anotherobject by sending a message to it. Of course, somewhere or other
the real-world functions must be implemented.

Function-oriented techniques group functions together if, as a group, they constitutea higher level function. On the other
hand, object-oriented techniques group functionstogether on the basis of the data they operate on.
To illustrate the differences between the object-oriented and the function-oriented
design approaches, let us consider an example—that of an automated fire-alarm system
for a large building.
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

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 7

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.
/* Global data (system state) accessible by various functions */
BOOL detector_status[MAX_ROOMS];
int detector_locs[MAX_ROOMS];
BOOL alarm-status[MAX_ROOMS]; /* alarm activated when status is set */
int alarm_locs[MAX_ROOMS]; /* room number where alarm is located */
int neighbour-alarms[MAX-ROOMS][10]; /* each detector has at most */
/* 10 neighbouring alarm locations */
int sprinkler[MAX_ROOMS];
The functions which operate on the system state are:
interrogate_detectors();
get_detector_location();
determine_neighbour_alarm();
determine_neighbour_sprinkler();
ring_alarm();
activate_sprinkler();
reset_alarm();
reset_sprinkler();
report_fire_location();

Object-oriented approach: In the object-oriented approach, the different classes of objects


are identified. Subsequently, the methods and data for each object are identified. Finally,
an appropriate number of instances of each class is created.
class detector
attributes: status, location, neighbours
operations: create, sense-status, get-location, find-neighbours
class alarm
attributes: location, status
operations: create, ring-alarm, get_location, reset-alarm
class sprinkler
attributes: location, status
operations: create, activate-sprinkler, get_location, reset-sprinkler
We can now compare the function-oriented and the object-oriented approaches based on
the two examples discussed above, and easily observe the following main differences:
„. In a function-oriented program, the system state (data) is centralised and several
functions access and modify this central data. In case of an object-oriented program,
the state information (data) is distributed among various objects.
„. In the object-oriented design, data is private in different objects and these are not
available to the other objects for direct access and modification.
„. The basic unit of designing an object-oriented program is objects, whereas it is
functions and modules in procedural designing. Objects appear as nouns in the

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 8

problem description; whereas functions appear as verbs.


User interface is the front-end application view to which user interacts in order to use the software. User can manipulate
and control the software as well as hardware by means of user interface. Today, user interface is found at almost every place
where digital technology exists, right from computers, mobile phones, cars, music players, airplanes, ships etc. There are various
types of user interfaces, each catering to different interaction styles and contexts. Here are some common types of user interfaces:
UI can be graphical, text-based, audio-video based, depending upon the underlying hardware and software combination. UI
can be hardware or software or a combination of both.
The software becomes more popular if its user interface is:
 Attractive
 Simple to use
 Responsive in short time
 Clear to understand
 Consistent on all interfacing screens

UI is broadly divided into two categories:


1.Graphical User Interface (GUI)(WINDOWS):
GUI is one of the most prevalent types of user interfaces. It uses visual elements like icons, buttons, windows, and menus to enable
users to interact with the system. Users manipulate these elements using a pointing device like a mouse or touch screen.
GUI includes following basic components.
1. Windows: Window is the area on the display screen where the commonly used application runs.
2. Icons: Icon is a symbol or picture which represents an application or hardware device.
3. Menus: Menu represents a list of options where the user can choose what they require.
4. Pointers:Pointer represents an angled arrow which moves around the screen as user moves the mouse. It helps user to select
objects and commands.
GUI uses these basic components to carry out commands such as opening, deleting, moving files etc.Windows, Linux, Mac OS,
Chrome OS are the examples of GUI operating system.

2.Command-Line Interface (CLI)(MS DOS):


CLI relies on text-based commands that users type into a terminal or command prompt. It's commonly used by developers, system
administrators, and power users who prefer keyboard-based interactions. CLI interfaces are efficient for tasks that require precision
and automation.

Characteristics of good user interface


1. Clarity and Simplicity: The UI should present information and controls in a clear and straightforward manner. Avoid clutter
and unnecessary complexity. Users should be able to understand how to navigate and use the interface without confusion
2. User Familiarity: Interfaces should be designed with elements and interactions that are familiar to users based on their
previous experiences with other applications or websites. This reduces the learning curve and makes the interface more
intuitive to use.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 9

3. Consistency: Consistency refers to maintaining uniformity in design elements and interactions throughout the interface.
Elements like buttons, colors, typography, and layout should follow a consistent pattern, so users can predict how the
interface will behave. This consistency helps users develop a mental model of how the interface works)
4. Minimal Surprise: This principle involves avoiding unexpected or confusing behaviors that might surprise users. Actions and
outcomes should be aligned with user expectations to prevent frustration or confusion.
5. Recoverability: Users should be able to recover from errors or unintended actions easily. The interface should provide clear
error messages, options to undo actions, and straightforward paths to rectify mistakes.
6. User Guidance: Providing appropriate guidance and feedback to users is essential for helping them understand how to use
the interface effectively. Instructions, tooltips, and onboarding processes can assist users in navigating the interface.
7. User Diversity: Interfaces should be designed to accommodate a wide range of users, including those with varying abilities,
preferences, and cultural backgrounds. Accessibility features, localization, and customizable settings are helps to a more
inclusive user experience.

Difference between GUI and CUI (text based interface)

Key GUI CUI

Interaction User interacts with computer using Graphics like User interacts with computer using commands
images, icons. like text.

Navigation Navigation is easy. Navigation is difficult.

Peripherals used Keyboard, mouse or any other pointing device. Only keyboard.

Precision GUI has low precision. CUI has high precision.

Speed GUI is of low speed. CUI is of high speed.

Usage Usage is easy. Usage is difficult, requires expertise.

Memory High memory requirement. Low memory requirement.


requirement

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 10

Flexibility Highly flexible user interface. Little flexible user interface.

Customize GUI is highly customizable. CUI appearance is not easily changeable.

User Guidance and On-line Help


Users may seek help about the operation of the software any time while using the software.
This is provided by the on-line help system. This is different from the guidance and error
messages which are flashed automatically without the user asking for them.

On-line help system: Users will expect the on-line help messages to be tailored in which they invoke the “help

system”. Also, the help messages should be tailored to the


user’s experience level. Furthermore, an effective online help system should not only be a copy of the user manual but
should make use of the screen's graphics and animation features also.

Guidance messages: The guidance messages should be carefully designed to inform the user about the next actions
he might pursue, the current status of the system, the progress so far made in processing his last command, etc. A good
guidance system should have different levels of sophistication for different categories of users.

Error messages: Error messages are generated by a system either when the user commits some error or when some
errors encountered by the system during processing due to some exceptional conditions, such as out of memory,
communication link broken, etc. Users do not like error messages that are either ambiguous or too general such as “invalid
input or system error”. There should be good content in error messages.
The user shouldn't have to get any embarrassing background noise while receiving error and warnings from the user
interface system
How a specific mistake can be fixed should be provided in the notification. If necessary, the user should have the option of
calling up the online support system to learn more about the issue scenario.

Mode-based versus Modeless Interface


A mode is a state or collection of states in which only a subset of all user interaction tasks can be performed. In a modeless
interface, the same set of commands can be invoked at any time during the running of the software. Thus, a modeless
interface has only a single mode and all the commands are available all the time during the operation of the software.
On the other hand, in a mode-based interface, different sets of commands can be invoked depending on the mode in
which the system is, i.e., the mode at any instant is determined by the sequence of commands already issued by the user. A
mode-based interface can be represented using a state transition diagram, where each node of the state transition diagram
would represent a mode. Each state of the state transition diagram can be annotated with the commands that are
meaningful in that state.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 11

TYPES OF USER INTERFACES


Broadly speaking, user interfaces can be classified into the following three categories:
1.Command Line based Interface
A Command Line Interface (CLI) is also known as Command-line User Interface and/or Console User Interface (CUI). It is a
type of human-computer interface (i.e., a way for humans to interact with digital computers or personal computer) that
relies solely on textual request and response transaction process. It can be expressed as, CLI is a user interface to a
computer’s operating system or application software in which the user responds to a visual prompt by instructing with typing
in a series of commands on a specified line and receives responses back from the system.

Advantages Command Line Interface (CLI):

The advantages of Command line interfaces are listed below;

 If the user knows the correct commands then this type of interface can be much faster than
any other type of interface.
 This type of interface needs much less memory (Random Access Memory) in order to use
compared to other types of user interfaces.
 This type of interface does not use as much CPU processing time as others
 A low resolution, cheaper monitor can be used with this type of interface.

A CLI does not require Windows to run.
Disadvantages Command Line Interface (CLI):;

 For someone who has never used a CLI, it can be very confusing.
 Commands have to be typed precisely. If there is a spelling mistake then the command will
not respond or fail.
 If user can mis-type an instruction, it is often necessary to start from scratch again.
 There are a large number of commands which need to be learned-in the case of Unix it can be
more than hundred.

Use can’t just guess what the instruction might be and user can’t just ‘have a go’.
Examples Command Line Interface (CLI):

 MS-DOS (Microsoft Disk Operating System),


 CP/M (Control Program for Microcomputers) and
 Apple DOS (Apple Disk Operating System)

2. Menu based interface :


Users make a selection from a list of possibilities presented to them by the system .
The selection may be made by pointing and clicking with a mouse, using cursor keys or by typing the name of the selection.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 12

May make use of simple-to-use terminals such as touch screens


Structuring Menu Interface
•Any one of the following options is adapted to structure menu items.
• Walking menu
• Scrolling menu
• Hierarchical menu

Advantages of menu driven interface


Avoids user error Little typing required
Guide user in the better way:
When we open any website then on top of the website we see menus. These menus help us where to go next. Like if we
want to see contact us page then we can easily find that page by seeing menus on that website. On some devices, menus are
designed in such a way that it gives access to our item very quickly.
The user does not need to remember a lot of commands:
Menu based interface is easy to use and user do not need to enter commands to work with the interface.
Used as providing customer support:
I think you may sometimes get the problem in your Internet or phone line. After you get the problem with your telephone
you have to call telephone company to fix the problem. When you call the company then you may hear a recorded voice
asking you to press 2 for aaa, press 2 for bb and so on. This automatic voice is behaving as menu and giving them support.
This type of interface is helping customers and saving their time
Used to withdraw money from banks:
If you have debit or credit card of the bank then you had used ATM (automatic teller machine) to withdraw money. The
screen you see on ATM is an interface with menus which guides you in performing numerous tasks including checking
balance, paying bills and withdrawing money as required.

Problems with menu systems

Actions which involve logical conjunction (and)or disjunction (or) are awkward to represent

Menu systems are best suited to presenting a small number of choices. If there are many choices, some menu
structuring facility must be used

Experienced users find menus slower than command language

Disadvantages of menu driven interface

Finding content: If there are many menus and also submenus then it becomes sometimes difficult
to find the required page
Menus take large space
Slow for experienced users Can become complex if many menu options

3. Direct Manipulation Interfaces


Direct manipulation interfaces present the interface to the user in the form of visual models
(i.e., icons2 or objects). For this reason, direct manipulation interfaces are sometimes called
as iconic interfaces. In this type of interface, the user issues commands by performing actions
on the visual representations of the objects,
some key characteristics and principles of Direct Manipulation Interfaces:

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 13

1.Physical Metaphors Direct Manipulation Interfaces often use physical metaphors, where on-screen
elements represent real-world objects or concepts. For example, dragging and dropping a file to move it
from one folder to another mimics the physical action of moving a physical object
2.Immediate Feedback DMI provides immediate and visible feedback to user actions. When users
interact with graphical elements, they can see the results of their actions in real-time. This immediate
feedback helps users understand the cause-and-effect relationship between their actions and the
interface's response.

3.Continuous Interaction Users can manipulate objects directly using actions like clicking, dragging,
tapping, pinching, and swiping. These continuous interactions create a sense of engagement and control,
as users can directly see how their actions affect the interface.
4.Manipulation of Objects: In DMI, users interact with objects rather than issuing commands through
text-based interfaces or menus. This approach simplifies complex tasks by allowing users to manipulate
objects in a more intuitive manner.
Examples of DMI include touch interfaces on smartphones and tablets, where users
interact with objects by tapping, swiping, and pinching. Graphic design software like Adobe Photoshop
also employs DMI principles, allowing users to directly manipulate images and graphical elements with
tools like selection, painting, and transformation.
Overall, Direct Manipulation Interfaces enhance user engagement, reduce errors, and improve the
overall user experience by aligning digital interactions with real-world behaviors and expectations.

Component-based development

A development style based on widgets is called component-based (or widget-based) GUI


development style. There are several important advantages of using a widget-based
design style. One of the most important reasons to use widgets as building blocks
is because they help users learn an interface fast. In this style of development, the user
interfaces for different applications are built from the same basic components. Therefore,
the user can extend his knowledge of the behavior of the standard components from
one application to the other. Also, the component-based user interface development style
reduces the application programmer’s work significantly as he is more of a user interface
component integrator than a programmer in the traditional sense.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 14

Visual programming
Visual programming is the drag and drop style of program development. In this style of user interface development, a
number of visual objects (icons) representing the GUI components are provided by the programming environment.
Window manager is the component of WMS with which the end-user interacts to do various window-related operations such
as window repositioning, window resizing, iconification, etc. The application programmer can easily develop the user
interface by dragging the required component types (e.g., menu, forms, etc.) from the displayed icons and placing them
wherever required.
Thus, visual programming can be considered as program development through manipulation of several visual objects.
Reuse of program components in the form of visual objects is an important aspect of this style of programming. Though
popular for user interface development, this style of programming can be used for other applications such as Computer-
Aided Design application (e.g., factory design), simulation, etc. User interface development using a visual programming
language greatly reduces the effort required to develop the interface.
Examples of popular visual programming languages are Visual Basic, Visual C++, etc.Visual C++ provides tools for
building programs with window-based user interfaces for Microsoft Windows environments. In visual C++ you usually design
menu bars, icons, and dialog boxes, etc. before adding them to your program. These objects are called as resources.
You can design shape, location, type, and size of the dialog boxes before writing any C++ code for the application.

Types of Widgets
A widget is a small, self-contained graphical element or component that serves a specific function or displays certain content
within a larger graphical user interface (GUI) or application. Widgets are designed to be interactive, allowing users to perform
actions, access information, or manipulate settings They are commonly used in technology contexts, such as on computer
desktops, mobile device home screens, web pages, and software applications, to enhance user experience and provide quick
access to frequently used features or information.

Different interface programming packages support different widget sets.


Label widget: This is probably one of the simplest widgets. A label widget does nothing
except to display a label, i.e., it does not have any other interaction capabilities and is not
sensitive to mouse clicks. A label widget is often used as a part of other widgets.
Container widget: These widgets do not stand by themselves, but exist merely to contain
other widgets. Other widgets are created as children of the container widget. When the
container widget is moved or resized, its children widget also get moved or resized. A
container widget has no callback routines associated with it.
Pop-up menu: These are transient and task specific. A pop-up menu appears upon
pressing the mouse button, irrespective of the mouse position.
Pull-down menu: These are more permanent and general. You have to move the cursor
to a specific location and pull down this type of menu.
Dialog boxes: We often need to select multiple elements from a selection list. A dialog box
remains visible until explicitly dismissed by the user. A dialog box can include areas for
entering text as well as values. If an apply command is supported in a dialog box, the newly

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 15

entered values can be tried without dismissing the box. Though most dialog boxes ask
you to enter some information, there are some dialog boxes which are merely informative,
alerting you to a problem with your system or an error you have made. Generally, these
boxes ask you to read the information presented and then click OK to dismiss the box.
Push button: A push button contains key words or pictures that describe the action that
is triggered when you activate the button. Usually, the action related to a push button
occurs immediately when you click a push button unless it contains an ellipsis (. . . ). A
push button with an ellipsis generally indicates that another dialog box will appear.
Radio buttons: A set of radio buttons are used when only one option has to be selected
out of many options. A radio button is a hollow circle followed by text describing the
option it stands for. When a radio button is selected, it appears filled and the previously
selected radio button from the group is unselected. Only one radio button from a group
can be selected at any time. This operation is similar to that of the band selection buttons
that were available in old radios.
Combo boxes: A combo box looks like a button until the user interacts with it. When the
user presses or clicks it, the combo box displays a menu of items to choose from. Normally
a combo box is used to display either one-of-many choices when space is limited, the
number of choices is large, or when the menu items are computed at run-time.

Unified Modeling Language (UML) is a general purpose modeling language. The main aim of UML is
to define a standard way to visualize the way a system has been designed. It is quite similar to blueprints used
in other fields of engineering. UML is not a programming language, it is rather a visual language. We use UML
diagrams to portray the behavior and structure
of a system.
UML helps software engineers, businessmen and system architects with modeling, design and analysis. The
Object Management Group (OMG) adopted Unified Modelling Language as a standard in 1997. Its been
managed by OMG ever since. International Organization for Standardization (ISO) published UML as an
approved standard in 2005. UML has been revised over the years and is reviewed periodically.

Goals of UML

A picture is worth a thousand words, this idiom absolutely fits describing UML. Object-oriented concepts were introduced
much earlier than UML. At that point of time, there were no standard methodologies to organize and consolidate the object-
oriented development. It was then that UML came into picture.

There are a number of goals for developing UML but the most important is to define some general purpose modeling
language, which all modelers can use and it also needs to be made simple to understand and use.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 16

UML diagrams are not only made for developers but also for business users, common people, and anybody interested to
understand the system. The system can be a software or non-software system. Thus it must be clear that UML is not a
development method rather it accompanies with processes to make it a successful system.

In conclusion, the goal of UML can be defined as a simple modeling mechanism to model all possible practical systems in
today’s complex environment.

Role of UML in OO Design

UML is a modeling language used to model software and non-software systems. Although UML is used for non-software
systems, the emphasis is on modeling OO software applications. Most of the UML diagrams discussed so far are used to
model different aspects such as static, dynamic, etc.

Hence, the relation between OO design and UML is very important to understand. The OO design is transformed into
UML diagrams according to the requirement. Before understanding the UML in detail, the OO concept should be learned
properly. Once the OO analysis and design is done, the next step is very easy. The input from OO analysis and design is the
input to UML diagrams.

Thus, before learning UML, it becomes important to understand OO concept in detail.

Following are some fundamental concepts of the object-oriented world −

 Objects − Objects represent an entity and the basic building block.


 Class − Class is the blue print of an object.
 Abstraction − Abstraction represents the behavior of an real world entity.
 Encapsulation − Encapsulation is the mechanism of binding the data together and hiding them from the
outside world.
 Inheritance − Inheritance is the mechanism of making new classes from existing ones.
 Polymorphism − It defines the mechanism to exists in different forms.

List the building blocks of UML :

The building blocks of UML can be defined as −

 Things

 Relationships

 Diagrams
Things
Things are the most important building blocks of UML. Things can be −

 Structural

 Behavioral

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 17

 Grouping

 Annotational

2.Relationship is another most important building block of UML. It shows how the elements are associated with each other

and this association describes the functionality of an application.

3.UML Diagrams

UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are used to make a complete
UML diagram and the diagram represents a system.

The visual effect of the UML diagram is the most important part of the entire process. All the other elements are used to
make it complete.

Explain the UML building blocks


The building blocks of UML can be defined as −

 Things
 Relationships
 Diagrams
Things

Things are the most important building blocks of UML. Things can be −

 Structural
 Behavioral
 Grouping
 Annotational

Structural Things

Structural things define the static part of the model. They represent the physical and conceptual elements.
Following are the brief descriptions of the structural things.

Class − Class represents a set of objects having similar responsibilities.

Interface − Interface defines a set of operations, which specify the responsibility of a class.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 18

Collaboration −Collaboration defines an interaction between elements.

Use case −Use case represents a set of actions performed by a system for a specific goal.

Component −Component describes the physical part of a system.

Node − A node can be defined as a physical element that exists at run time.

Behavioral Things

A behavioral thing consists of the dynamic parts of UML models. Following are the behavioral things −

Interaction − Interaction is defined as a behavior that consists of a group of messages exchanged among elements
to accomplish a specific task.

State machine − State machine is useful when the state of an object in its life cycle is important. It defines the
sequence of states an object goes through in response to events. Events are external factors responsible for state
change

Grouping Things

Grouping things can be defined as a mechanism to group elements of a UML model together. There is only one
grouping thing available −

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 19

Package − Package is the only one grouping thing available for gathering structural and behavioral things.

Annotational Things

Annotational things can be defined as a mechanism to capture remarks, descriptions, and comments of UML
model elements. Note - It is the only one Annotational thing available. A note is used to render comments,
constraints, etc. of an UML element.

Relationship

Relationship is another most important building block of UML. It shows how the elements are associated with
each other and this association describes the functionality of an application.

There are four kinds of relationships available.

Dependency

Dependency is a relationship between two things in which change in one element also affects the other.

Association

Association is basically a set of links that connects the elements of a UML model. It also describes how many
objects are taking part in that relationship.

Generalization

Generalization can be defined as a relationship which connects a specialized element with a generalized element.
It basically describes the inheritance relationship in the world of objects.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 20

Realization

Realization can be defined as a relationship in which two elements are connected. One element describes some
responsibility, which is not implemented and the other one implements them. This relationship exists in case of
interfaces.

UML Diagrams

UML diagrams are the ultimate output of the entire discussion. All the elements, relationships are used to make a
complete UML diagram and the diagram represents a system.

The visual effect of the UML diagram is the most important part of the entire process. All the other elements are
used to make it complete.

UML includes the following nine diagrams, the details of which are described in the subsequent chapters.

 Class diagram
 Object diagram
 Use case diagram
 Sequence diagram
 Collaboration diagram
 Activity diagram
 State chart diagram
 Deployment diagram
 Component diagram

UML basic notations :UML is popular for its diagrammatic notations. We all know that UML is for
visualizing, specifying, constructing and documenting the components of software and non-software
systems. Hence, visualization is the most important part which needs to be understood and
remembered.
 UML notations are the most important elements in modeling. Efficient and appropriate use of
notations is very important for making a complete and meaningful model.
Class Notation
UML class is represented by the following figure. The diagram is divided into four parts.

 The top section is used to name the class.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 21

 The second one is used to show the attributes of the class.


 The third section is used to describe the operations performed by the class.
 The fourth section is optional to show any additional components.

Classes are used to represent objects. Objects can be anything having properties and responsibility.

Object Notation
The object is represented in the same way as the class. The only difference is the name which is
underlined as shown in the following figure.

As the object is an actual implementation of a class, which is known as the instance of a class. Hence, it
has the same usage as the class.

Interface Notation
Interface is represented by a circle as shown in the following figure. It has a name which is generally
written below the circle.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 22

Interface is used to describe the functionality without implementation. Interface is just like a template
where you define different functions, not the implementation. When a class implements the interface, it
also implements the functionality as per requirement.

Collaboration Notation
Collaboration is represented by a dotted eclipse as shown in the following figure. It has a name written
inside the eclipse.

Collaboration represents responsibilities. Generally, responsibilities are in a group.

Use Case Notation


Use case is represented as an eclipse with a name inside it. It may contain additional responsibilities.

Use case is used to capture high level functionalities of a system.

Actor Notation
An actor can be defined as some internal or external entity that interacts with the system.

An actor is used in a use case diagram to describe the internal or external entities.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 23

Initial State Notation


Initial state is defined to show the start of a process. This notation is used in almost all diagrams.

The usage of Initial State Notation is to show the starting point of a process.

Final State Notation


Final state is used to show the end of a process. This notation is also used in almost all diagrams to
describe the end.

The usage of Final State Notation is to show the termination point of a process.

Active Class Notation


Active class looks similar to a class with a solid border. Active class is generally used to describe the
concurrent behavior of a system.

Active class is used to represent the concurrency in a system.

Component Notation
A component in UML is shown in the following figure with a name inside. Additional elements can be
added wherever required.

Component is used to represent any part of a system for which UML diagrams are made.

Node Notation

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 24

A node in UML is represented by a square box as shown in the following figure with a name. A node
represents the physical component of the system.

Node is used to represent the physical part of a system such as the server, network, etc

Behavioral Things
Dynamic parts are one of the most important elements in UML. UML has a set of powerful features to
represent the dynamic part of software and non-software systems. These features
include interactions and state machines.
Interactions can be of two types −

 Sequential (Represented by sequence diagram)

 Collaborative (Represented by collaboration diagram)


Interaction Notation
Interaction is basically a message exchange between two UML components. The following diagram
represents different notations used in an interaction.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 25

Interaction is used to represent the communication among the components of a system.

State Machine Notation


State machine describes the different states of a component in its life cycle. The notations are described
in the following diagram.

State machine is used to describe different states of a system component. The state can be active, idle,
or any other depending upon the situation.

Grouping Things
Organizing the UML models is one of the most important aspects of the design. In UML, there is only
one element available for grouping and that is package.

Package Notation
Package notation is shown in the following figure and is used to wrap the components of a system.

Annotational Things
In any diagram, explanation of different elements and their functionalities are very important. Hence,
UML has notes notation to support this requirement.

Note Notation
This notation is shown in the following figure. These notations are used to provide necessary
information of a system.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 26

Relationships
A model is not complete unless the relationships between elements are described properly.
The Relationship gives a proper meaning to a UML model. Following are the different types of
relationships available in UML.

 Dependency

 Association

 Generalization

 Extensibility
Dependency Notation
Dependency is an important aspect in UML elements. It describes the dependent elements and the
direction of dependency.
Dependency is represented by a dotted arrow as shown in the following figure. The arrow head
represents the independent element and the other end represents the dependent element.

Dependency is used to represent the dependency between two elements of a system


Association Notation
Association describes how the elements in a UML diagram are associated. In simple words, it describes
how many elements are taking part in an interaction.
Association is represented by a dotted line with (without) arrows on both sides. The two ends represent
two associated elements as shown in the following figure. The multiplicity is also mentioned at the ends
(1, *, etc.) to show how many objects are associated.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 27

Association is used to represent the relationship between two elements of a system.

Generalization Notation
Generalization describes the inheritance relationship of the object-oriented world. It is a parent and
child relationship.
Generalization is represented by an arrow with a hollow arrow head as shown in the following figure.
One end represents the parent element and the other end represents the child element.

Generalization is used to describe parent-child relationship of two elements of a system.

Extensibility Notation
All the languages (programming or modeling) have some mechanism to extend its capabilities such as
syntax, semantics, etc. UML also has the following mechanisms to provide extensibility features.

 Stereotypes (Represents new elements)

 Tagged values (Represents new attributes)

 Constraints (Represents the boundaries)

Extensibility notations are used to enhance the power of the language. It is basically additional elements
used to represent some extra behavior of the system. These extra behaviors are not covered by the
standard available notations.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 28

UML-Diagrams
The UML diagrams are categorized into structural diagrams, behavioral diagrams, and also
interaction overview diagrams. The diagrams are hierarchically classified in the following figure:

Q.State the purpose of Class diagram and draw simple class diagrams?

Class diagram is a static diagram. It represents the static view of an application. Class diagram is not only used for
visualizing, describing, and documenting different aspects of a system but also for constructing executable code of the
software application.

Class diagram describes the attributes and operations of a class and also the constraints imposed on the system. The class
diagrams are widely used in the modeling of object-oriented systems because they are the only UML diagrams, which can be
mapped directly with object-oriented languages.

Class diagram shows a collection of classes, interfaces, associations, collaborations, and constraints. It is also known as a
structural diagram.

Purpose of Class Diagrams

The purpose of the class diagram can be summarized as −

 Analysis and design of the static view of an application.


 Describe responsibilities of a system.
 Base for component and deployment diagrams.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 29

 Forward and reverse engineering.

Where to Use Class Diagrams


Class diagram is a static diagram and it is used to model the static view of a system. The static view describes the vocabulary
of the system.

class diagrams are used for −

 Describing the static view of the system.


 Showing the collaboration among the elements of the static view.
 Describing the functionalities performed by the system.
 Construction of software applications using object oriented languages.

Q.What is Use case diagram ? State the purpose of Use case diagram and draw simple example of Use
case diagram?

Use case diagram, define the term Use case, purposes of Use case diagram, draw the Use case diagram
A use case diagram is a type of diagram in UML (Unified Modeling Language) that is used to visualize the
functional requirements and interactions of a system from a user's perspective. It depicts the various use cases,
actors, and their relationships within a system
Purpose of Use Case Diagrams
The purpose of use case diagram is to capture the dynamic aspect of a system. Use case diagrams are used to
gather the requirements of a system including internal and external influences. These requirements are mostly
design requirements. Hence, when a system is analyzed to gather its functionalities, use cases are prepared and
actors are identified.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 30

 Used to gather the requirements of a system.


 Used to get an outside view of a system.
 Identify the external and internal factors influencing the system.
 Show the interaction among the requirements are actors.

A simple example of a use case diagram for an ATM (Automated Teller Machine) system:
Actors:
Customer (Primary user)
Bank (System)
Use Cases:
Withdraw Cash: The customer can withdraw cash from their account.
Check Balance: The customer can check their account balance.
Deposit Funds: The customer can deposit money into their account.
Change PIN: The customer can change their PIN (Personal Identification Number).
Provide Receipt: The ATM provides a receipt for transactions.
Authenticate User: The system authenticates the user's identity.
Associations:
The "Customer" actor is associated with all use cases because the customer initiates all interactions.
The "Bank" actor is associated with the "Authenticate User" use case, as it is responsible for authenticating the
user's identity.
Use Case Diagram:

In this use case diagram, you can see how the customer interacts with the ATM system through various use cases.
The "Customer" actor initiates these interactions, and the "Bank" actor is responsible for authenticating the user's
identity. Each use case represents a specific functionality of the ATM system. This diagram provides a high-level
overview of the ATM's functionality and its interactions with users.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 31

Interaction diagram, purposes of Interaction diagram, the types of interaction diagrams : Sequence diagram and
Collaboration diagram, draw the Interaction diagrams.

Interaction diagrams are used to visualize the dynamic behavior of a system, showing how objects interact
with each other to achieve a specific goal.
The purpose of interaction diagram is :
• To capture the dynamic behaviour of a system.
• To describe the message flow in the system.
• To describe the structural organization of the objects.
• To describe the interaction among objects
There are two main types of interaction diagrams in UML: Sequence Diagrams and Collaboration Diagrams.
1.The Sequence Diagram

The sequence diagram has four objects (Customer, Order, SpecialOrder and NormalOrder).

The following diagram shows the message sequence for SpecialOrder object and the same can be used in case
of NormalOrder object. It is important to understand the time sequence of message flows. The message flow is
nothing but a method call of an object.

The first call is sendOrder () which is a method of Order object. The next call is confirm () which is a method
of SpecialOrder object and the last call is Dispatch () which is a method of SpecialOrder object. The following
diagram mainly describes the method calls from one object to another, and this is also the actual scenario when
the system is running.

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor


UNIT-4 Software Design, Coding and Testing 32

2.The Collaboration Diagram

The second interaction diagram is the collaboration diagram. It shows the object organization as seen in the
following diagram. In the collaboration diagram, the method call sequence is indicated by some numbering
technique. The number indicates how the methods are called one after another. We have taken the same order
management system to describe the collaboration diagram.

Method calls are similar to that of a sequence diagram. However, difference being the sequence diagram does
not describe the object organization, whereas the collaboration diagram shows the object organization.

To choose between these two diagrams, emphasis is placed on the type of requirement. If the time sequence is
important, then the sequence diagram is used. If organization is required, then collaboration diagram is used.

draw the Interaction diagrams

SVREC NANDYALA Prepared by B.KIRAN BABU., M.Tech(CSE) Assistant Professor

You might also like