Se Unit 4
Se Unit 4
Se Unit 4
For example , the memory size used up by a Program may be an important issue to
characterize a good solution for Embedded Software Development
The criteria used to judge how good a given design solution is can vary widely depending
on the Application
The design itself varies widely across Software Engineers and Academicians
Good design should possess certain characteristics that every designer should agree
Correctness:
A good design should correctly implement all the functionalities of the system
Understandability:
1
The primary characteristics of a neat module decomposition are high Cohesion and low
Coupling
A module having high Cohesion and low Coupling is said to be functionally independent
of other modules
By the term Functional Independence, we mean that a cohesive module performs a single
task or function
Functional Independence is a key to any Good design primarily due to some reasons
Logical Cohesion
Temporal Cohesion
Procedural Cohesion
Communicational Cohesion
Sequential Cohesion
Functional Cohesion
Coincidental Cohesion
A module is said to have coincidental cohesion, if it performs a set of tasks that relate to
each other very loosely, if at all
In this case , module contains a random collection of functions
It is likely that the functions have put in the module out of pure coincidence without any
thought or design
Logical Cohesion
A module is said to have logical cohesion, if all elements of the module perform similar
operations
e.g. error handling, data input, data output, etc.
An example : Set of print functions generating different output reports are arranged into
a single module
Temporal Cohesion
When a module contains functions that all the functions must be executed in the same
time span, the module is said to exhibit temporal cohesion
2
Example : The set of functions responsible for initialization, start-up, shut-down of
some process, etc. exhibit temporal cohesion
Procedural Cohesion
A module is said to possess procedural cohesion, if the set of functions of the module are
all part of a procedure in which certain sequence of steps has to be carried out for
achieving an objective
Communicational Cohesion
A module is said to have communicational cohesion, if all the functions of the module
refer to or update the same data structure
Sequential Cohesion
A module is said to possess sequential cohesion, if the elements of a module form the
parts of a sequence, where the output from one element of a sequence is input to the next
Functional Cohesion
For example, a module containing all the functions required to manage employees
payroll displays functional cohesion
The degree of coupling between two modules indicates the degree of interdependence
between them
The degree of coupling between two modules depends on their interface complexity
The interface complexity is depends on the number of types of parameters that are
interchanged while invoking the functions of the module
If two modules interchange large amounts of data, then they are highly interdependent
3
Classification of Coupling
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 float, a character, etc.
This data item should be problem related and not used for the control purpose
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 flag 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
Algorithmic perspective
Starting at high-level view of the system, each function is successively refined into more
detailed sub functions
Four Steps:
Create-member-record
Assign-membership-number
Print-bill
5
Design Activities to be carried out:
Identify Classes
OOD -Advantages
Data is highly secured. The functions defined for one object cannot change data of other
objects
Responsibility driven design ( Actions carried out are entirely the responsibility of
objects )
Objects enter early in to the life cycle of Software development, better refined
requirements
Smooth transition from phase to phase in OOD hence less errors / faults
In OOD, System is decomposed in to basic units called objects. The System is viewed as
a collection of objects
In FOD, The System state is centralized and shared among different functions
In OOD, the System state is decentralized among the objects and each object manages its
own state information
In OOD, object is not an operation, it is an entity that represents some data items
together with operation
6
In FOD, data is not secured
In OOD, single object of stack, but two operations are visible outside
Function-oriented techniques, such as SA/SD, group the functions together if, as a group,
they constitute a higher-level function
On the other hand, the object-oriented techniques group the functions together on the
basis of the data they operate on
Speed of Use
Speed Recall
Error Prevention
Attractiveness
Consistency
Feedback
Support for Multiple Skill Levels
Error Recovery ( Undo Facility)
User Guidance and Online Help
Speed of Learning
Speed of Use
The speed of use of an User Interface is determined by the time and user effort necessary
to initiate and execute different commands
Speed of Recall
Once users learn how to use an Interface, the speed with which they recall the command
issue procedure should be maximized.
The speed of recall is improved of the Interface is based on some metaphors, symbolic
command issue procedures, and intuitive command names
Error Prevention
Good User Interface should minimize the scope of committing errors while initiating
different commands
The Error Rate of an Interface can be easily determined by monitoring the errors
committed by an average User while using the interface
Attractiveness
In this respect, graphics-based user interfaces have a definite advantage over the text-
based interfaces
Consistency
Consistency is to help users generalize the knowledge of aspects of the Interface from
one part to another
Consistency facilitates speed of learning, speed of recall, and also helps in reducing the
error rate
Feedback
8
Good User Interface must provide feedback to various User Actions
Especially, if any user request takes more than a few seconds to process, the user should be
informed about the state of the processing of his request
In the absence of any response from the computer for a long time, a novice user might
even start recovery / shutdown procedures
If required, the user should be periodically informed about the progress being made in
processing his command
Good User Interface should support multiple levels of sophistication of command issue
procedure for different categories of users
This is necessary because users with different levels of experience in using an application
prefer different types of Users Interfaces
Error Recovery
While issuing commands even the expert users can commit errors
Therefore a Good User Interface should allow a user to undo a mistake committed by
him while using the interface
Users are inconvenienced if they cannot recover even from very simple types of errors,
they feel irritated, helpless, and out of control
Users seek guidance and online help when they either forget a command or unaware of
some features of the software
Whenever users need guidance or seek help from the system, they should be assisted in
overcoming the problem at hand
• Guidance Messages
• Error Messages
9
User Guidance and Online Help
• Users may seek help to learn about the operation of the software any time using Online
Help System while using the Software
• Online Help is different from the Guidance and Error Messages which are flashed
automatically without the User asking for them
• The Guidance messages prompt the User with the options he has regarding the next
command and the status of the last command
• Users expect the Online Help Messages to be tailored to the context in which they invoke
the ‘Help System’.
• A Good Online Help System should keep track of what a user is doing while invoking
the Help system and provide the output message in a context-dependent way.
• A Good Online Help System should take advantage of any graphics and animation
characteristics of the screen and just not be a copy of the user’s Manual
Guidance Messages
• A Good Guidance System should have different levels of sophistication for different
categories of users.
Error Messages
• Proper Error Messages should be generated in case of errors encountered by the system
or user due to some exceptional conditions, such as out of memory Avoid error messages
that are either ambiguous or too general such as ‘ invalid input or system error ’
• Error messages should be polite. Error messages should not have associated noise which
might embarrass the user
10
• The message should be informative how a given error can be rectified
• 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.
11
4.4.3 Types of User Interfaces
• Three Categories of User Interfaces :
• Design appropriate commands using the language and assign unique names to different
commands
• Allows user to compose complex commands by using set of primitive commands which
reduces the number of command names available
• Allows faster interaction with the computer and simplify the input of complex commands
• Allows user to compose complex commands by using set of primitive commands which
reduces the number of command names available
• Allows faster interaction with the computer and simplify the input of complex commands
• Easier to develop compared to other Interfaces, because compilers are available such as
LEX and YACC
12
Command Language Based Interface Disadvantages
• Difficult to learn and requires user to memorize the set of primitive commands
• All interactions with the system are through a keyboard not through mouse
• Minimized typing : All interactions are carried through menu selection using pointing
device such as mouse
• Composing commands is not possible because logical connection of actions are awkward
to specify
• Difficult to design a menu based interface, if the number of choices are large
A major challenge in the design of a Menu Based Interface is that of structuring the large
number of menu choices into manageable forms
– Scrolling menu.
– Walking menu.
– Hierarchical menu.
• When a full choice cannot be displayed within the menu area, scrolling of the menu items
is required
• This enables the user to view and select the menu items that cannot be accommodated on
the screen
• In a scrolling menu, all the commands should be highly correlated, so that the user can
easily locate a command that he needs
13
• User cannot see all the commands at any one time
Walking Menu
• Walking menu is a commonly used menu to structure a large collection of menu items
• In this technique, when a menu item is selected, it causes submenus displayed on right
side of the selected option
Hierarchical Menu
• Selection a menu item causes the current menu display to be replaced by an appropriate
submenu
• One can consider the menu and its various sub-menus to form a hierarchical tree-like
structure
14
• It is a walking menu can be considered to be a form of hierarchical menu which is
practicable when the tree is shallow
• Hierarchical menu can be used to manage a large number of choices, but the users are
likely to face navigational problems and therefore lose track of their where abouts in the
menu tree
• Direct manipulation present the interface to the user in the form of visual models i.e.
icons or objects
• Advantages - Icons can be recognized very easily and icons are language independent
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.
15
4.5.2. Know the role of UML in Object Oriented Design
UML is a modelling language used to model software and non-software systems. Although
UML is used for non-software systems, the emphasis is on modelling OO software applications.
Most of the UML diagrams discussed so far are used to model different aspects such as static,
dynamic, etc. Now whatever be the aspect, the artefacts is nothing but objects.
If we look into class diagram, object diagram, collaboration diagram, interaction diagrams all
would basically be designed based on the objects.
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.
4.5.3. List the building blocks of UML.
The building blocks of UML can be defined as −
Things
Relationships
Diagrams
4.5.4. 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
An notational
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.
16
Interface − Interface defines a set of operations, which specify the responsibility of a class.
Use case −Use case represents a set of actions performed by a system for a specific goal.
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 −
17
Package − Package is the only one grouping thing available for gathering structural and
behavioral things.
An notational Things
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
18
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
4.5.5. Know the different symbols used in UML notation
Class:
Interface:
Collaboration:
Use case:
19
Component:
Node :
Message:
State machine :
Package:
Note -
Dependency
Association
Generalization
Realization
20
4.5.6. Classify and list standard UML diagrams
4.6 Know 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.
21
How to Draw a Class Diagram?
Class diagrams are the most popular UML diagrams used for construction of software
applications. It is very important to learn the drawing procedure of class diagram.
Class diagrams have a lot of properties to consider while drawing but here the diagram will be
considered from a top level view.
Class diagram is basically a graphical representation of the static view of the system and
represents different aspects of the application. A collection of class diagrams represent the
whole system.
The following points should be remembered while drawing a class diagram −
The name of the class diagram should be meaningful to describe the aspect of the
system.
Each element and their relationships should be identified in advance.
Responsibility (attributes and methods) of each class should be clearly identified
For each class, minimum number of properties should be specified, as unnecessary
properties will make the diagram complicated.
Use notes whenever required to describe some aspect of the diagram. At the end of the
drawing it should be understandable to the developer/coder.
Finally, before making the final version, the diagram should be drawn on plain paper and
reworked as many times as possible to make it correct.
The following diagram is an example of an Order System of an application. It describes a
particular aspect of the entire application.
First of all, Order and Customer are identified as the two elements of the system. They
have a one-to-many relationship because a customer can have multiple orders.
Order class is an abstract class and it has two concrete classes (inheritance relationship)
SpecialOrder and NormalOrder.
The two inherited classes have all the properties as the Order class. In addition, they have
additional functions like dispatch () and receive ().
The following class diagram has been drawn considering all the points mentioned above.
22
4.7 4.7.1.Define the term Use case
A use case is a list of actions or event steps typically defining the interactions between a role
(known in the Unified Modeling Language (UML) as an actor) and a system to achieve a goal.
4.7.2.Know the purposes of Use casediagram
The main purpose of a use case diagram is to portray the dynamic aspect of a system. It
accumulates the system's requirement, which includes both internal as well as external
influences. It invokes persons, use cases, and several things that invoke the actors and elements
accountable for the implementation of use case diagrams. It represents how an entity from the
external environment can interact with a part of the system.
Following are the purposes of a use case diagram given below:
1. It gathers the system's needs.
2. It depicts the external view of the system.
3. It recognizes the internal as well as external factors that influence the system.
4. It represents the interaction between the actors.
It is essential to analyze the whole system before starting with drawing a use case diagram, and
then the system's functionalities are found. And once every single functionality is identified, they
are then transformed into the use cases to be used in the use case diagram.
After that, we will enlist the actors that will interact with the system. The actors are the person or
a thing that invokes the functionality of a system. It may be a system or a private entity, such that
it requires an entity to be pertinent to the functionalities of the system to which it is going to
interact.
Once both the actors and use cases are enlisted, the relation between the actor and use case/
system is inspected. It identifies the no of times an actor communicates with the system.
Basically, an actor can interact multiple times with a use case or system at a particular instance
of time.
Following are some rules that must be followed while drawing a use case diagram:
1. A pertinent and meaningful name should be assigned to the actor or a use case of a
system.
2. The communication of an actor with a use case must be defined in an understandable
way.
3. Specified notations to be used as and when required.
4. The most significant interactions should be represented among the multiple no of
interactions between the use case and actors.
23
Example of a Use Case Diagram
A use case diagram depicting the Online Shopping website is given below.
Here the Web Customer actor makes use of any online shopping website to purchase online. The
top-level uses are as follows; View Items, Make Purchase, Checkout, Client Register. The View
Items use case is utilized by the customer who searches and view products. The Client
Register use case allows the customer to register itself with the website for availing gift
vouchers, coupons, or getting a private sale invitation. It is to be noted that the Checkout is an
included use case, which is part of Making Purchase, and it is not available by itself.
24
4.8.2. List the types of interaction diagrams
The sequence diagram has four objects (Customer, Order, Special Order and Normal Order).
The following diagram shows the message sequence for Special Order object and the same can
be used in case of Normal Order 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 Special Order 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.
25
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.
26