Software Engineering Lab Manual for CSE
Software Engineering Lab Manual for CSE
LABORATORY MANUAL
1
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Late Purushottam Hari (Ganesh) Patil Shikshan Sanstha’s
Mauli Group of Institution’s, College of Engineering & Technology,
Shegaon.
EXPT.
NO.
EXPERIMENT DESCRIPTION
3 To Model UML Use Case Diagrams and Capturing Use Case Scenarios.
2
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 01
Title: Identifying the Requirements from Problem Statements
Resources:
Software Required: Operating System
Hardware Required: Computer System
Theory:
Requirements
Requirements can be defined as a specification of what should be implemented. Requirements
specify how the target system should behave. It specifies what to do, but not how to do.
Requirements engineering refers to the process of understanding what a customer expects from
the system to be developed, and to document them in a standard and easily readable and
understandable format. This documentation will serve as reference for the subsequent design,
implementation and verification of the system.
It is necessary and important that before we start planning, design and implementation of the
software system for our client, we are clear about it's requirements. If we don't have a clear
vision of what is to be developed and what all features are expected, there would be serious
problems, and customer dissatisfaction as well.
Characteristics of Requirements:
Requirements gathered for any new system to be developed should exhibit the following three
properties:
Unambiguity: There should not be any ambiguity what a system to be developed should do.
For example, consider you are developing a web application for your client. The client requires
that enough number of people should be able to access the application simultaneously. What's
the "enough number of people"? That could mean 10 to you, but, perhaps, 100 to the client.
There's an ambiguity.
Consistency: To illustrate this, consider the automation of a nuclear plant. Suppose one of the
clients say that it the radiation level inside the plant exceeds R1, all reactors should be shut
3
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
down. However, another person from the client side suggests that the threshold radiation level
should be R2. Thus, there is an inconsistency between the two end users regarding what they
consider as threshold level of radiation.
Completeness: A particular requirement for a system should specify what the system should
do and also what it should not. For example, consider a software to be developed for ATM. If
a customer enters an amount greater than the maximum permissible withdrawal amount, the
ATM should display an error message, and it should not dispense any cash.
Categorization of Requirements
Based on the target audience or subject matter, requirements can be classified into different
types, as stated below:
User requirements: They are written in natural language so that both customers can verify
their requirements have been correctly identified
System requirements: They are written involving technical terms and/or specifications, and
are meant for the development or testing teams.
Requirements can be classified into two groups based on what they describe:
Functional requirements (FRs): These describe the functionality of a system -- how a system
should react to a particular set of inputs and what should be the corresponding output.
Non-functional requirements (NFRs): They are not directly related what functionalities are
expected from the system. However, NFRs could typically define how the system should
behave under certain situations. For example, a NFR could say that the system should work
with 128MB RAM. Under such condition, a NFR could be more critical than a FR.
Non-functional requirements could be further classified into different types like:
Product requirements: For example, a specification that the web application should use only
plain HTML, and no frames
Performance requirements: For example, the system should remain available 24x7
Organizational requirements: The development process should comply to SEI CMM level 4
Functional Requirements
Identifying Functional Requirements:
Given a problem statement, the functional requirements could be identified by focusing on the
following points:
Identify the high level functional requirements simply from the conceptual understanding of
the problem. For example, a Library Management System, apart from anything else, should be
able to issue and return books.
Identify the cases where an end user gets some meaningful work done by using the system
If we consider the system as a black box, there would be some inputs to it, and some output in
return. This black box defines the functionalities of the system. For example, to search for a
book, user gives title of the book as input and get the book details and location as the output.
4
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Any high level requirement identified could have different sub-requirements.
Identification of non-functional requirements
Having talked about functional requirements, let's try to identify a few non-functional
requirements.
Performance Requirements:
This system should remain accessible 24x7
At least 50 users should be able to access the system altogether at any given
time
Security Requirements:
This system should be accessible only within the institute LAN
The database of LIS should not store any password in plain text -- a hashed
value has to be stored
Software Quality Attributes
Database Requirements
Design Constraints:
The system should be developed using HTML 5
Once all the functional and non-functional requirements have been identified, they are
documented formally in SRS, which then serves as a legal agreement.
5
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 02
Title: Estimation of Project Metrics
Resources:
Software Required: Operating System
Hardware Required: Computer System
Theory:
A software project is not just about writing a few hundred lines of source code to achieve a
particular objective. One of the major activities of the project planning phase, is to estimate
various project parameters in order to take proper decisions. Some important project parameters
that are estimated include:
Project size: What would be the size of the code written say, in number of lines, files, modules?
Cost: How much would it cost to develop a software?
Duration: How long would it be before the software is delivered to the clients?
Effort: How much effort from the team members would be required to create the software?
In this experiment we will focus on two methods for estimating project metrics: COCOMO
and Halstead's method.
COCOMO
COCOMO (Constructive Cost Model) was proposed by Boehm. According to him, there
could be three categories of software projects: organic, semidetached, and embedded.
Organic: A development project is said to be of organic type, if
The project deals with developing a well understood application.
Semidetached: A development project can be categorized as semidetached type, if the team
consists of some experienced as well as inexperienced staff
Embedded: Embedded type of development project are those, which
aims to develop a software strongly related to machine hardware.
6
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Boehm suggested that estimation of project parameters should be done through three stages:
Basic COCOMO, Intermediate COCOMO, and Complete COCOMO.
Basic COCOMO Model
The basic COCOMO model helps to obtain a rough estimate of the project parameters. It
estimates effort and time required for development in the following way:
Effort = a * (KDSI)b PM
Tdev = 2.5 * (Effort)c Months
where
KDSI is the estimated size of the software expressed in Kilo Delivered Source Instructions
a, b, c are constants determined by the category of software project
Effort denotes the total effort required for the software development, expressed in person
months (PMs)
Tdev denotes the estimated time required to develop the software (expressed in months)
Intermediate COCOMO Model
The basic COCOMO model considers that effort and development time depends only on the
size of the software. However, in real life there are many other project parameters that
influence the development process. The intermediate COCOMO take those other factors into
consideration by defining a set of 15 cost drivers (multipliers). Thus, any project that makes
use of modern programming practices would have lower estimates in terms of effort and cost.
Each of the 15 such attributes can be rated on a six-point scale ranging from "very low" to
"extra high" in their relative order of importance. Each attribute has an effort multiplier fixed
as per the rating. The product of effort multipliers of all the 15 attributes gives the Effort
Adjustment Factor (EAF).
Complete COCOMO Model
Both the basic and intermediate COCOMO models consider a software to be a single
homogeneous entity -- an assumption, which is rarely true. In fact, many real life applications
are made up of several smaller sub-systems. The complete COCOMO model takes these factors
into account to provide a far more accurate estimate of project metrics.
Advantages of COCOMO
COCOMO is a simple model, and should help one to understand the concept of project metrics
estimation.
Drawbacks of COCOMO
COCOMO uses KDSI, which is not a proper measure of a program's size.
Indeed, estimating the size of a software is a difficult task, and any slight miscalculation
could cause a large deviation in subsequent project estimates.
COCOMO II was proposed later in 2000 to many of address these issues.
7
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Conclusion:Thus,we have studied to estimate the project metrics using cocomo model.
COCOMO
COCOMO (Constructive Cost Model), Seminar on Software Cost Estimation WS 2002 / 2003,
presented by Nancy Merlo – Schett
Suggested Question
[Link] to the COCOMO model, a project can be categorized into how many types?
8
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 03
Title: Modelling UML Use Case Diagrams and Capturing Use Case
Scenarios
Aim: To Model UML Use Case Diagrams and Capturing Use Case Scenarios
Learning Outcome: After completing this experiment, you will be able to:
[Link] identify different actors and use cases from a given problem statement
[Link] associate use cases with different types of relationships
[Link] draw a use-case diagram
Resources:
Theory:
Introduction
Use case diagram is a platform that can provide a common understanding for the end-users,
developers and the domain experts. It is used to capture the basic functionality i.e. use cases,
and the users of those available functionality, i.e. actors, from a given problem statement.
In this experiment, we will learn how use cases and actors can be captured and how different
use cases are related in a system.
9
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Use Case
Use cases include both successful and unsuccessful scenarios of user interactions with the
system. For example, authentication of a customer by the ATM would fail if he enters wrong
PIN. In such case, an error message is displayed on the screen of the ATM.
Subject
Subject is simply the system under consideration. Use cases apply to a subject. For example,
an ATM is a subject, having multiple use cases, and multiple actors interact with it.
Graphical Representation
An actor is represented by a stick figure and name of the actor is written below it. A use case
is depicted by an ellipse and name of the use case is written inside it. The subject is shown by
drawing a rectangle. Label for the system could be put inside it. Use cases are drawn inside the
rectangle, and actors are drawn outside the rectangle, as shown in figure - 01.
10
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Include Relationship
Include relationships are used to depict common behaviour that are shared by multiple use
cases. This could be considered analogous to writing functions in a program in order to avoid
repetition of writing the same code..
Extend Relationship
Use case extensions are used used to depict any variation to an existing use case. They are used
to the specify the changes required when any assumption made by the existing use case
becomes false.
Generalization Relationship
Generalization relationship are used to represent the inheritance between use cases. A derived
use case specializes some functionality it has already inherited from the base use case.
11
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Figure - 04: Generalization relationship among use cases
Identifying Actors
Given a problem statement, the actors could be identified by asking the following questions.
Who gets most of the benefits from the system? (The answer would lead to the identification
of the primary actor)
Who keeps the system working? (This will help to identify a list of potential users)
What other software / hardware does the system interact with?
Identifying Use cases
Any use case name should start with a verb like, "Check balance".
Conclusion: Thus, we have learned UML Model and drawn Use Case diagrams.
Webliography
Use Case Diagrams
Use case diagram -- Wikipedia
Unified Modeling Language, Superstructure, V2.1.2
12
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Suggested Questions:
[Link] does a use case diagram represent?
2. In a use case diagram, relationships between different actors are normally shown
True
False
[Link] cases can be used for testing, which includes
1. Validation
2. Verification
3. Both
4. None
13
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 04
Title: E-R Modeling from the Problem Statements
Resources:
Theory
Entity Relationship Model
Entity-Relationship model is used to represent a logical design of a database to be created. In
ER model, real world objects (or concepts) are abstracted as entities, and different possible
associations among them are modeled as relationships.
For example, student and school -- they are two entities. Students study in school. So, these
two entities are associated with a relationship "Studies in".
Entity Set and Relationship Set
An entity set is a collection of all similar entities. For example, "Student" is an entity set that
abstracts all students. Ram, John are specific entities belonging to this set. Similarly, a
"Relationship" set is a set of similar relationships.
Attributes of Entity
Attributes are the characteristics describing any entity belonging to an entity set. Any entity in
a set can be described by zero or more attributes.
For example, any student has got a name, age, an address
These data are the attributes of the entity set Student.
Keys
One or more attribute(s) of an entity set can be used to define the following keys:
Super key: One or more attributes, which when taken together, helps to uniquely identify an
entity in an entity set.
14
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Candidate key: It is a minimal subset of a super key. In other words, a super key might contain
extraneous attributes, which do not help in identifying an object uniquely. When such attributes
are removed, the key formed so is called a candidate key.
Primary key: A database might have more than one candidate key. Any candidate key chosen
for a particular implementation of the database is called a primary key.
Prime attribute: Any attribute taking part in a super key.
Weak Entity
An entity set is said to be weak if it is dependent upon another entity set.
Entity Generalization and Specialization
Once we have identified the entity sets, we might find some similarities among them. For
example, multiple person interacts with a banking system. Most of them are customers, and
rest employees or other service providers. Here, customers, employees are persons, but with
certain specializations. Or in other way, person is the generalized form of customer and
employee entity sets.
ER model uses the "ISA" hierarchy to depict specialization (and thus, generalization).
Mapping Cardinalities
One of the main tasks of ER modeling is to associate different entity sets. Let's consider two
entity sets E1 and E2 associated by a relationship set R. Based on the number of entities in E1
and E2 are associated with, we can have the following four type of mappings:
One to one: An entity in E1 is related to at most a single entity in E2, and vice versa.
One to many: An entity in E1 could be related to zero or more entities in E2. Any entity in E2
could be related to at most a single entity in E1.
Many to one: Zero or more number of entities in E1 could be associated to a single entity in
E2. However, an entity in E2 could be related to at most one entity in E1.
Many to many: Any number of entities could be related to any number of entities in E2,
including zero, and vice versa.
ER Diagram
From a given problem statement we identify the possible entity sets, their attributes, and
relationships among different entity sets. Once we have this information, we represent them
pictorially, called an entity-relationship (ER) diagram.
Graphical Notations for ER Diagram
15
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Term Notation Remarks
Relationship with
weak entity set
Importance of ER modelling
16
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
redundancy and maintain data integrity. Thus, to have data stored efficiently, the ER diagram
is to be drawn as much detailed and accurate as possible.
Conclusion:
In this way, we have learned E-R modelling from problem statement and how to find the
entities, its attributes and how the relationships between the entities can be established for a
system.
References for Further Reading:
Bibliography
1. Database System Concepts, Henry F. Korth , Abraham Silberschatz, McGraw Hills, 5th Edition
Webliography
Entity-relationship modelling
Suggested Questions:
Q1. Entity Relationship model is used to represent the database at a
Logical level
Physical level
[Link] ER model an entity is usually related to another entity. The relationship is indicated by
a
True
False
Q 4. Students study in schools -- this is a
1. 1:1 mapping 2. 1: N mapping
3 .M:1 mapping 4. M:M mapping
17
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 05
Title: Identifying Domain Classes from the Problem Statements
Resources:
Software Required: Star UML
Hardware Required: Computer System
Theory:
Introduction:
Same types of objects are typically implemented by class in object oriented programming. As
the structural unit of the system can be represented through the classes, so, it is very important
to identify the classes before start implementing all the logical flows of the system.
In this experiment we will learn how to identify the classes from a given problem statement.
Domain Class
In Object Oriented Paradigm Domain Object Model has become subject of interest for its
excellent problem comprehending capabilities towards the goal of designing a good software
system. Domain Model, as a conceptual model gives proper understanding of problem
description through its highly effective component – the Domain Classes. Domain classes are
the abstraction of key entities, concepts or ideas presented in the problem statement. Domain
classes are used for representing business activities during the analysis phase.
Below we discuss some techniques that can be used to identify the domain classes.
Traditional Techniques for Identification of Classes
Grammatical Approach Using Nouns
This object identification technique was proposed by Russell J. Abbot, and Grady Booch made
the technique popular . This technique involves grammatical analysis of the problem statement
to identify list of potential classes. The logical steps are:
Obtain the user requirements (problem statement) as a simple, descriptive English text.
This basically corresponds to the use-case diagram for the problem statement.
18
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Identify and mark the nouns, pronouns and noun phrases from the above problem
statements
List of potential classes is obtained based on the category of the nouns. For example,
nouns that direct refer to any person, place, or entity in general, correspond to different
objects. And so does singular proper nouns. On the other hand, plural nouns and
common nouns are candidates that usually map into classes.
Advantages
1. This is one of the simplest approaches that could be easily understood and applied by a
larger section of the user base.
2. The problem statement does not necessarily be in English, but in any other language.
Disadvantages
1. The problem statement always may not help towards correct identification of a class.
At times it could give us redundant classes.
2. When the problem statement may use abbreviations for large systems or concepts, and
therefore, the identified class may actually point to an aggregate of classes. In other
words, it may not find all the objects.
Using Generalization
In this approach, all potential objects are classified into different groups based on some
common behaviour. Classes are derived from these groups.
Using Subclasses
Here, instead of identifying objects one goes for identification of classes based on some similar
characteristics. These are the specialized classes. Common characteristics are taken from them
to form the higher-level generalized classes.
Steps to Identify Domain Classes from Problem Statement
We now present the steps to identify domain classes from a given problem statement. This
approach is mostly based on the “Grammatical approach using nouns” discussed above, with
some insights from.
Make a list of potential objects by finding out the nouns and noun phrases from narrative
problem statement
Apply subject matter expertise (or domain knowledge) to identify additional classes
Filter out the redundant or irrelevant classes
Classify all potential objects based on categories. We follow the category table as described by
Ross
Categories Explanation
19
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Categories Explanation
Group the objects based on similar attributes. While grouping we should remember that
Different nouns (or noun phrases) can actually refer to the same thing (examples: house, home,
abode)
Same nouns (or noun phrases) could refer to different things or concepts (example: I go to
school every day / This school of thought agrees with the theory)
Give related names to each group to generate the final list of top-level classes
Iterate over to refine the list of classes
Advanced Concepts
Identification of domain classes might not be a simple task for novices. It requires expertise
and domain knowledge to identify business classes from plain English text. A lot of work has
been done in this area, and various techniques have been proposed to identify domain classes.
Conclusion: Thus, we have understood the concept of domain classes and learned identifying
the domain classes from problem statements.
References for further reading:
1. UML and C++ A Practical Guide To Object-Oriented Development, Richard C. Lee,
William M. Tepfenhart, Prentice-Hall of India, 2nd Edition, 2005
2. Fundamentals of Software Engineering, Rajib Mall, Prentice-Hall of India, 3rd Edition,
2009
Suggested Questions:
Q 2. Classes contain the same type objects – here the same type means
1. Coming from the same sources 2. They are of same data type
20
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 06
Resources:
Statechart Diagrams
A statechart diagram is a pictorial representation of such a system, with all it's states, and
different events that lead transition from one state to another.
To illustrate this, consider a computer. Some possible states that it could have are: running,
shutdown, hibernate. A transition from running state to shutdown state occur when user presses
the "Power off" switch, or clicks on the "Shut down" button as displayed by the OS. Here,
clicking on the shutdown button, or pressing the power off switch act as external events causing
the transition.
Statechart diagrams are normally drawn to model the behaviour of a complex system. For
simple systems this is optional.
Building Blocks of a Statechart Diagram
State
A state is any "distinct" stage that an object (system) passes through in it's lifetime. An object
remains in a given state for finite time until "something" happens, which makes it to move to
another state. All such states can be broadly categorized into following three types:
Initial: The state in which an object remain when created
Final: The state from which an object do not move to any other state.
21
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Intermediate: Any state, which is neither initial, nor final
As shown in figure-01, an initial state is represented by a circle filled with black. An
intermediate state is depicted by a rectangle with rounded corners. A final state is represented
by a unfilled circle with an inner black-filled circle.
(intermediate) state
Figure-02: A typical state in a statechart diagram
Transition
Transition is movement from one state to another state in response to an external stimulus (or
any internal event). A transition is represented by a solid arrow from the current state to the
next state. It is labelled by: event [guard-condition]/[action-expression], where
Event is the what is causing the concerned transition (mandatory)
Guard-condition is (are) precondition(s), which must be true for the transition to happen
[optional]
Action-expression indicate action(s) to be performed as a result of the transition [optional]
22
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
It may be noted that if a transition is triggered with one or more guard-condition(s), which
evaluate to false, the system will continue to stay in the present state. Also, not all transitions
do result in a state change.
Action
As mentioned in actions represents behaviour of the system. The order in which different
actions are executed, is given below:
[Link] actions of the present state
[Link] specified for the transition
[Link] actions of the next state
Figure-03 shows a typical state chart diagram with all its syntaxes.
Activity Diagrams
Activity diagrams fall under the category of behavioural diagrams in Unified Modeling
Language. It is a high level diagram used to visually represent the flow of control in a system.
However, it is more powerful than a simple flow chart since it can represent various other
concepts like concurrent activities, their joining, and so on.
These diagrams are typically used when the business logic is complex.
Components of an Activity Diagram
Below we describe the building blocks of an activity diagram.
Activity
An activity denotes a particular action taken in the logical flow of control. An activity is
represented with a rounded rectangle, as shown in table-01. A label inside the rectangle
identifies the corresponding activity.
There are two special type of activity nodes: initial and final. They are represented with a filled
circle, and a filled in circle with a border respectively.
23
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Flow
A flow (also termed as edge, or transition) is represented with a directed arrow. This is used to
depict transfer of control from one activity to another, .A flow is often accompanied with a
label, called the guard condition, indicating the necessary condition for the transition to happen.
Decision
A decision node, represented with a diamond, is a point where a single flow enters and two or
more flows leave. The control flow can follow only one of the outgoing paths. The outgoing
edges often have guard conditions indicating true-false or if-then-else conditions.
Merge
This is represented with a diamond shape, with two or more flows entering, and a single flow
leaving out.
Fork
Fork is a point where parallel activities begin. A fork is graphically depicted with a black bar,
with a single flow entering and multiple flows leaving out.
Join
A join is depicted with a black bar, with multiple input flows, but a single output flow.
Physically it represents the synchronization of all concurrent activities.
Note
UML allows attaching a note to different components of a diagram to present some textual
information.
Partition
Different components of an activity diagram can be logically grouped into different areas,
called partitions or swimlanes. They often correspond to different units of an organization or
different actors.
The following table shows commonly used components with a typical activity diagram.
Activity
Flow
24
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Component Graphical Notation
Decision
Merge
Fork
Join
Note
A Simple Example
25
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Figure-04 shows a simple activity diagram with two activities. The figure depicts two stages
of a form submission. At first a form is filled up with relevant and correct information. Once it
is verified that there is no error in the form, it is then submitted. The two other symbols shown
in the figure are the initial node (dark filled circle), and final node (outer hollow circle with
inner filled circle). It may be noted that there could be zero or more final node(s) in an activity
diagram.
26
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Suggested Questions
1. What does an entry action of a state indicate?
[Link] does the guard condition depicted over the transition between any two states indicate?
3. A state can contain one or more sub-state(s) within it
4. What does forking of several activities from a synchronization point indicate?
5. A decision point in an activity diagram is a control where
27
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 07
Resources:
Class diagram
It is a graphical representation for describing a system in context of its static construction.
Elements in class diagram
Class diagram contains the system classes with its data members, operations and relationships
between classes.
Class
A set of objects containing similar data members and member functions is described by a class.
In UML syntax, class is identified by solid outline rectangle with three compartments which
contain
Class name
28
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
A class is uniquely identified in a system by its name. A textual string is taken as class
name. It lies in the first compartment in class rectangle.
Attributes
Property shared by all instances of a class. It lies in the second compartment in class
rectangle.
Operations
An execution of an action can be performed for any object of a class. It lies in the last
compartment in class rectangle.
Example
To build a structural model for an Educational Organization, ‘Course’ can be treated as a class
which contains attributes ‘courseName’ & ‘courseID’ with the operations ‘addCourse()’ &
‘removeCourse()’ allowed to be performed for any object to that class.
Figure-01:
Generalization/Specialization
It describes how one class is derived from another class. Derived class inherits the
properties of its parent class.
Example
Figure-02:
29
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Geometric_Shapes is the class that describes how many sides a particular shape has. Triangle,
Quadrilateral and Pentagon are the classes that inherit the property of the Geometric_Shapes class. So,
the relations among these classes are generalization. Now Equilateral_Triangle, Isosceles_Triangle and
Scalene_Triangle, all these three classes inherit the properties of Triangle class as each one of them has
three sides. So, these are specialization of Triangle class.
Relationships
Existing relationships in a system describe legitimate connections between the classes in that system.
Association
It is an instance level relationship that allows exchanging messages among the objects of both ends of
association. A simple straight line connecting two class boxes represent an association. Association
may be uni-directional.
Example
In structure model for a system of an organization an employee (instance of ‘Employee’ class) is always
assigned to a particular department (instance of ‘Department’ class) and the association can be shown
by a line connecting the respective classes.
Figure-03:
Aggregation
In a relationship, when a class holds some instances of related class, then that relationship can be
designed as an aggregation.
Example
For a supermarket in a city, each branch runs some of the departments they have. So, the relation among
the classes ‘Branch’ and ‘Department’ can be designed as an aggregation. In UML, it can be shown as
in the fig. below
Figure-04:
Composition
It is a strong from of aggregation which describes that whole is completely owns its part. Life cycle of
the part depends on the whole.
Example
30
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Let consider a shopping mall has several branches in different locations in a city. The existence of
branches completely depends on the shopping mall as if it is not existing any branch of it will no longer
exists in the city. This relation can be described as composition and can be shown as below
Figure-05:
Multiplicity
It describes how many numbers of instances of one class is related to the number of instances of another
class in an association.
Notation for different types of multiplicity:
Figure-06:
Example
One vehicle may have two or more wheels
Figure-07:
Sequence diagram
It represents the behavioral aspects of a system Sequence diagram shows the interactions between the
objects by means of passing messages from one object to another with respect to time in a system.
Elements in sequence diagram
Sequence diagram contains the objects of a system and their life-line bar and the messages passing
between them.
Object
Objects appear at the top portion of sequence diagram. Object is shown in a rectangle box. Name of
object precedes a colon ‘:’ and the class name, from which the object is instantiated. The whole string
is underlined and appears in a rectangle box. Also, we may use only class name or only instance name.
Objects which are created at the time of execution of use case and are involved in message passing , are
appear in diagram, at the point of their creation.
31
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Life-line bar
A down-ward vertical line from object-box is shown as the life-line of the object. A rectangle bar on
life-line indicates that it is active at that point of time.
Messages
Messages are shown as an arrow from the life-line of sender object to the life-line of receiver object
and labeled with the message name. Chronological order of the messages passing throughout the
objects’ life-line show the sequence in which they occur. There may exist some different types of
messages:
Synchronous messages:Receiver start processing the message after receiving it and sender needs to
wait until it is made. A straight arrow with close and fill arrow-head from sender life-line bar to receiver
end, represent a synchronous message.
Asynchronous messages:For asynchronous message sender needs not to wait for the receiver to
process the message. A function call that creates thread can be represented as an asynchronous message
in sequence diagram.A straight arrow with open arrow-head from sender life-line bar to receiver end,
represent an asynchronous message.
Return message:For a function call when we need to return a value to the object, from which it was
called, then we use return message. But it is optional, and we are using it when we are going to model
our system in much detail. A dashed arrow with open arrow-head from sender life-line bar to receiver
end, represent that message.
Response message:One object can send a message to self. We use this message when we need
to show the interaction between the same object.
Conclusion: In this way, we have learned to model UML class diagrams and sequence
diagrams.
References for Further Reading:
Bibliography
Fundamentals of Software Engineering, Rajib Mall, Prentice-Hall of India, 3rd Edition, 2009
THE UNIFIED MODELING LANGUAGE USER GUIDE, GRADY BOOCH, JAMES RUMBAUGH, IVAR
JACOBSON, ADDISON-WESLEY, Low Priced Edition, 2000
Webliography
Class diagram
32
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Asynchronous message , UML sequence diagram
Suggested Questions:
Q1.A class is a
[Link] 2. Specific instance of an object
3. Category of user requirement 4. None of the above
33
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 08
Resources:
External
Name of the external entity is written inside the rectangle
entity
34
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Term Notation Remarks
Data flow Data flow is represented by a directed arc with its data name
Note:
External entities only appear in context diagram i.e, only at level 0.
Keep number of processes at each level less than 7.
Data flow is not possible in between two external entities and in between two data stores.
Data cannot flow from an External entity to a data store and vice-versa.
Conclusion:
35
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
In this way we have learned to model data flow diagrams.
References for Further Reading:
Bibliography
Software Engineering, Ian Sommerville, Addison Wesley Longman, 9th Edition, March 2010
Fundamentals of Software Engineering, Rajib Mall, Prentice-Hall of India, 3rd Edition, 2009
Webliography
NPTEL course material - System Analysis and Design
Software Engineering Virtual Lab - Simulation
Software Engineering Virtual Lab - Case Study
Suggested Questions:
Q1. A DFD represents
Flow of control
Flow of data
Both the above
Neither one
[Link] is not a component of a DFD?
Data flow
Decision
Process
Data store
Two processes
36
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 09
A control flow graph (CFG) is a directed graph where the nodes represent different instructions
of a program, and the edges define the sequence of execution of such instructions. Figure 1
shows a small snippet of code (compute the square of an integer) along with it's CFG. For
simplicity, each node in the CFG has been labeled with the line numbers of the program
containing the instructions. A directed edge from node #1 to node #2 in figure 1 implies that
after execution of the first statement, the control of execution is transferred to the second
instruction.
int x = 10, x_2 = 0;
x_2 = x * x;
return x_2;
37
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Figure 1: A simple program and it's CFG
A program, however, doesn't always consist of only sequential statements. There could be
branching and looping involved in it as well. Figure 2 shows how a CFG would look like if
there are sequential, selection and iteration kind of statements in order.
38
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
sum += i;
++i;
}
printf("%d", sum);
if (sum > 0) {
printf("Positive");
}
The CFG with basic blocks is shown for the above code in figure 3.
The first statement of a basic block is termed as leader. Any node x in a CFG is said to dominate
another node y (written as x dom y) if all possible execution paths that goes through node y must
pass through node x. The node x is said to be a dominator [ii]. In the above example, line #s 1, 3, 4, 6,
7, 9, 10 are leaders. The node containing lines 7, 8 dominate the node containing line # 10. The block
containing line #s 1, 2 is said to be the entry block; the block containing line # 10 is said to be the exit
block.
If any block (or sub-graph) in a CFG is not connected with the sub-graph containing the entry block,
that signifies the concerned block contains code, which is unreachable while the program is
executed. Such unreachable code can be safely removed from the program. To illustrate this, let's
consider a modified version of our previous code:
sum = 0;
39
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
i = 1;
while (i ≤ n) {
sum += i;
++i;
return sum;
if (sum < 0) {
return 0;
}
Figure 4 shows the corresponding CFG. The sub-graph containing line #s 8, 9, 10 is disconnected from
the graph containing the entry block. The code in the disconnected sub-graph would never get
executed, and, therefore, could be discarded.
40
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
independent paths.
It has been suggested that the Cyclomatic complexity of any module should not exceed 10.
Doing so would make a module difficult to understand for humans. If any module is found to
have Cyclomatic complexity greater than 10, the module should be considered for redesign.
Note that, a high value of V(G) is possible for a given module if it contains multiple cases in
C like switch-case statements. McCabe had exempted such modules from the limit of V(G) as
10.
Merits
McCabe's Cyclomatic complexity has certain advantages:
Independent of programming language
Helps in risk analysis during development or maintenance phase
Gives an idea about the maximum number of test cases to be executed (hence, the required
effort) for a given module
Demerits
Cyclomatic complexity doesn't reflect on cohesion and coupling of modules.
41
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
McCabe's Cyclomatic complexity was originally proposed for procedural languages. One may
look in to get an idea of how the complexity calculation could be modified for object-oriented
languages.
Conclusion:
In this way, we have to Estimation of Test Coverage Metrics and Structural Complexity
Webliography
Structured Testing: A Testing Methodology Using the Cyclomatic Complexity Metric
Control flow graphs and loop optimizations - Purdue Engineering
Control Flow Analysis
Suggested Questions:
42
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
PRACTICAL NO: 10
44
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
compatibility testing, recovery testing, maintenance testing, documentation testing, and
usability testing. Software testing are mainly of following types
Unit Testing
Integration Testing
System Testing
Unit Testing
Unit testing is done at the lowest level. It tests the basic unit of software, that is the smallest
testable piece of software. The individual component or unit of a program are tested in unit
testing. Unit testing are of two types.
Black box testing: This is also known as functional testing , where the test cases are designed
based on input output values only. There are many types of Black Box Testing but following
are the prominent ones.
- Equivalence class partitioning: In this approach, the domain of input values to a program is
divided into a set of equivalence classes. e.g. Consider a software program that computes
whether an integer number is even or not that is in the range of 0 to 10. Determine the
equivalence class test suite. There are three equivalence classes for this program. - The set of
negative integer - The integers in the range 0 to 10 - The integer larger than 10
- Boundary value analysis : In this approach, while designing the test cases, the values at
boundaries of different equivalence classes are taken into consideration. e.g. In the above given
example as in equivalence class partitioning, a boundary values based test suite is { 0, -1, 10,
11 }
White box testing: It is also known as structural testing. In this testing, test cases are designed
on the basis of examination of the code. This testing is performed based on the knowledge of
how the system is implemented. It includes analysing data flow, control flow, information flow,
coding practices, exception and error handling within the system, to test the intended and
unintended software behavior. White box testing can be performed to validate whether code
implementation follows intended design, to validate implemented security functionality, and
to uncover exploitable [Link] testing requires access to the source code. Though
white box testing can be performed any time in the life cycle after the code is developed, but it
is a good practice to perform white box testing during the unit testing phase.
Integration Testing
Integration testing is performed when two or more tested units are combined into a larger
structure. The main objective of this testing is to check whether the different modules of a
program interface with each other properly or not. This testing is mainly of two types:
Top-down approach
Bottom-up approach
In bottom-up approach, each subsystem is tested separately and then the full system is tested.
But the top-down integration testing starts with the main routine and one or two subordinate
45
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
routines in the system. After the top-level ‘skeleton’ has been tested, the immediately
subroutines of the ‘skeleton’ are combined with it and tested.
System Testing
System testing tends to affirm the end-to-end quality of the entire system. System testing is
often based on the functional / requirement specification of the system. Non-functional quality
attributes, such as reliability, security, and maintainability are also checked. There are three
types of system testing
Alpha testing is done by the developers who develop the software. This testing is also done
by the client or an outsider with the presence of developer or we can say tester.
Beta testing is done by very few numbers of end users before the delivery, where the change
requests are fixed, if the user gives any feedback or reports any type of defect.
User Acceptance testing is also another level of the system testing process where the system
is tested for acceptability. This test evaluates the system's compliance with the client
requirements and assess whether it is acceptable for software delivery
An error correction may introduce new errors. Therefore, after every round of error-fixing,
another testing is carried out, i.e. called regression testing.
Regression Testing
The purpose of regression testing is to ensure that bug fixes and new functionality introduced
in a software do not adversely affect the unmodified parts of the program. Regression testing
is an important activity at both testing and maintenance phases. When a piece of software is
modified, it is necessary to ensure that the quality of the software is preserved. To this end,
regression testing is to retest the software using the test cases selected from the original test
suite.
Conclusion:In this way we have learned about designing test suites.
References fir Further Reading:
Bibliography
Fundamentals of Software Engineering, Rajib Mall, Prentice-Hall of India, 3rd Edition, 2009
Software Engineering: A Practioner's Approach, Roger S. Pressman, McGraw Hills, 7th
Edition, 2009
Webliography
Standards for software test documentation
JUnit frameworks
Selenium frameworks
Developing Test Plans
46
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Suggested Questions.
[Link] testing is the process of
Customer
Tester
Developer
Set of inputs
Set of outputs
Functional testing
Development testing
Maintenance testing
5. Acceptance testing is done by
Developers
Customers
47
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Testers
Verification
Validation
Regression testing
Development
Identification of faults
Validation
Functional testing
9. Testing of software with actual data and in the actual environment is called
Alpha testing
Beta testing
Regression testing
Unit testing
48
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab
Bottom up testing
Integration testing
Acceptance testing
49
DEPT: Computer Science & Engineering/Sem VI/Software Engineering Lab