You are on page 1of 37

JAGAN INSTITUTE OF MANAGEMENT STUDIES

Sector - 5, Rohini, New Delhi

(Affiliated to)

GURU GOBIND SINGH INDRAPRASTHA UNIVERSITY

SECTOR – 16 C, DWARKA, NEW DELHI

SOFTWARE ENGINEERING
Practical File

Submitted to: Dr. Latika Kharb Submitted By: Shubham Rastogi

Professor (IT) Enrolment No.: 35425502021


BCA 4th Semester (Shift - 2)
2021-2024

Shubham Rastogi Page 1 of 37 35425502021


INDEX
S. No. Heading Page Faculty Sign

1 Introduction to Rational Rose 3-4

2 Introduction to UML 4

3 Use Case Diagram 5-6

4 Class Diagram 7-8

5 Sequence Diagram 9-10

6 Activity Diagram 11-12

7 StateChart Diagram 13-14

8 Entity-Relationship Diagram 15-16

9 Data Flow Diagram 17-18

10 Software Metrics 19-20

11 Test Cases 21-22

12 Mapping UML to code 23-29

Shubham Rastogi Page 2 of 37 35425502021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 1: Introduction to Rational Rose

• ROSE stands for Rational Object-oriented Software Engineering.


• Rational Rose is developed by Rational Corporation which is under IBM.
• Rational Rose is a tool for modeling software systems.
• Rational Rose supports UML.
• Rational Rose is a tool that supports round-trip engineering means a tool that supports
conversion of a model to code and from code to a model.

Toolbar: The toolbar contains the most frequently used actions like New, Open, Save etc…

Status Bar: The status bar at the bottom displays status messages.

Browser Window: The browser window displays the views: Use Case View, Logical View,
Component View and Deployment View. Each of these views contains the diagrams.

Shubham Rastogi Page 3 of 37 35425502021


Diagram Toolbar: The diagram toolbar displays the symbols of the respective type of diagram.

Diagram Window: The diagram window is the place where the user draws the diagrams using
the symbols from the diagram toolbar.
Log Window: This window is used to display error messages, warnings and information
messages.

Shubham Rastogi Page 4 of 37 35425502021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 2: INTRODUCTION TO UML


The Unified Modeling Language (UML) is a language used in the field of software engineering
that represent the components of the Object-Oriented Programming concepts. It is the general way
to define the whole software architecture or structure.

Why use UML Diagrams?


UML diagrams have many benefits for both software developers and businesspeople, and the most
key advantages are:

• Problem-Solving - Enterprises can improve their product quality and reduce cost
especially for complex systems in large scale. Some other real-life problems including
physical distribution or security can be solved;
• Improve Productivity - By using the UML diagram, everyone in the team is on the same
page and lots of time are saved down the line;
• Easy to Understand - Since different roles are interested in different aspects of the system,
the UML diagram offers non-professional developers, for example, stakeholders,
designers, or business researchers, a clear and expressive presentation of requirements,
functions and processes of their system.

Exercise: 1: Creating a Use Case Diagram

Use Case Diagram

Shubham Rastogi Page 5 of 37 35425502021


Use Case Diagram is one of them. Now as we have to discuss that the use case diagram is dynamic
in nature there should be some internal or external factors for making the interaction. These
internal and external agents are known as actors. So use case diagrams are consists of actors, use
cases and their relationships.

Rational Rose is a visual modeling tool, enabling the creation, analysis, design and modification
of components in a software system. This exercise is intended to show you how to draw a use
case diagram within Rational Rose.

Symbols Used

1. Actor:

2. Use case:

Steps to create Use Case Diagram

1. Identify the Actors (role of users) of the system.


2. For each category of users, identify all roles played by the users relevant to the system.
3. Identify what are the users required the system to be performed to achieve these goals.
4. Create use cases for every goal.
5. Structure the use cases.
6. Prioritize, review, estimate and validate the users.

Elements used in Use Case Diagram:

• Actor

• Use Case

• Association

Shubham Rastogi Page 6 of 37 35425502021


Example of Use Case Diagram:

Figure: Use Case Diagram of ATM

Shubham Rastogi Page 7 of 37 35425502021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 2: Creating a Class Diagram


Class Diagram
The 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.

The 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 modelling of object oriented
systems because they are the only UML diagrams which can be mapped directly with object
oriented languages.

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

Steps to create Class Diagram

1. Identify the objects in the problem domain, and create classes for each of them. (e.g.
Teacher, Student, Course for an enrollment system)
2. Add attributes for those classes (e.g. name, address, telephone for the Student class)
3. Add operations for those classes (e.g. addStudent(student) for the Course class)
4. Connect the classes with appropriate relationships (e.g. Relate Teacher and Course with an
association)
5. Optionally specify the multiplicities for association connectors' ends (e.g. Input 0..3 for the
Course side of the association that connects Teacher and Course, to signify that one teacher
can teach

Elements used in Class Diagram

• Class

• Generalization

Shubham Rastogi Page 8 of 37 35425502021


• Aggregation

• Association

Shubham Rastogi Page 9 of 37 35425502021


EXAMPLE of Class Diagram:

Figure: Class Diagram of ATM

Karman Arora Page 10 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 3: Creating a Sequence Diagram


Sequence Diagram
The 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.

The 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 modelling of object oriented
systems because they are the only UML diagrams which can be mapped directly with object
oriented languages.

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

Steps to create Sequence Diagram

1. Identify the objects in the problem domain and create classes for each of them. (e.g.,
Teacher, Student, Course for an Enrolment system)
2. Add attributes for those classes (e.g., name, address, telephone for the Student class)
3. Add operations for those classes (e.g., addStudent(student) for the Course class)
4. Connect the classes with appropriate relationships (e.g., Relate Teacher and Course with
an association)
5. Optionally, specify the multiplicities for association connectors' ends (e.g., Input 0..3 for
the Course side of the association that connects Teacher and Course)

Karman Arora Page 11 of 37 03450402021


Elements used in Sequence Diagram

• Actor

• Lifeline

• Self Message

• Activation

Karman Arora Page 12 of 37 03450402021


Example of Sequence Diagram:

Figure: Sequence diagram of ATM

Karman Arora Page 13 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 4: Creating an Activity Diagram


Activity Diagram
Activity Diagrams describe how activities are coordinated to provide a service which can be at
different levels of abstraction. Typically, an event needs to be achieved by some operations,
particularly where the operation is intended to achieve a number of different things that require
coordination, or how the events in a single use case relate to one another, in particular, use cases
where activities may overlap and require coordination. It is also suitable for modeling how a
collection of use cases coordinate to represent business workflows.

Steps to create Activity Diagram

1. Identify candidate use cases, through the examination of business workflows.


2. Identify pre- and post-conditions (the context) for use cases.
3. Model workflows between/within use cases.
4. Model complex workflows in operations on objects.
5. Model in detail complex activities in a high level activity Diagram.

Elements used in Activity Diagram

Activity

Used to represent a set of actions

Action

A task to be performed

Control Flow

Karman Arora Page 14 of 37 03450402021


Shows the sequence of execution

Object Flow

Shows the flow of an object from one activity


(or action) to another activity (or action)

Example of an Activity Diagram

Figure: Activity diagram of ATM

Karman Arora Page 15 of 37 03450402021


Karman Arora Page 16 of 37 03450402021
Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 5: Creating a StateChart Diagram


StateChart Diagram

A statechart diagram, also known as a state machine diagram, is a type of UML diagram that
represents the dynamic behaviour of a system or an object. It depicts the various states that an
object can be in and the transitions between those states based on events and conditions.

In a statechart diagram, states are represented as nodes or rectangles, and transitions between states
are depicted as arrows. Events trigger state transitions, and conditions or guards can be specified
to determine which transition should occur. Additionally, actions or activities can be associated
with states or transitions to indicate the behaviour or operations that take place during a particular
state or transition.

Statechart diagrams are useful for modelling complex systems or objects with a significant number
of possible states and transitions. They provide a visual representation of the system's behaviour,
making it easier to understand and analyse the different states and their relationships. Statechart
diagrams are commonly used in software development, especially in the design of reactive and
event-driven systems.

Steps to create StateChart Diagram

1. Determine the object or system for which you want to create the statechart diagram. Clearly
define the scope and boundaries of the object or system to be modeled.
2. Identify the distinct states that the object or system can be in. States represent the different
conditions or modes of the object or system. It is essential to determine the meaningful and
relevant states based on the behavior and characteristics of the object or system.
3. Determine the events or triggers that cause the object or system to transition from one state
to another. Identify the conditions or constraints that govern these transitions. Consider the
actions or activities that occur during the transition.
4. Represent the identified states as nodes (rectangles) in the statechart diagram. Connect the
states with arrows to depict the transitions. Label the arrows with the triggering events or
conditions that lead to the transitions.
5. Add additional information, such as actions or activities associated with each state or
transition. Include any necessary guards or conditions for the transitions. Review the
diagram for clarity, correctness, and completeness. Refine and revise as needed.

Karman Arora Page 17 of 37 03450402021


Elements used in StateChart Diagram:

• States
• Initial State
• Final State
• Transitions
• Events
• Conditions (Guards)
• Actions
• Hierarchical States

Example of a StateChart Diagram

Karman Arora Page 18 of 37 03450402021


Figure: StateChart diagram

Karman Arora Page 19 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 6: Creating an Entity-Relationship Diagram


Entity-Relationship Diagram

An Entity Relationship Diagram (ER Diagram) describes the relationship of entities that need to
be stored in a database. ER diagram is mainly a structural design for the database. It is a framework
using specialized symbols to define the relationship between entities. ER diagram is created based
on 3 main components entities, attributes, and relationships.

Elements used in Entity-Relationship Diagram

Karman Arora Page 20 of 37 03450402021


Karman Arora Page 21 of 37 03450402021
Example of an Entity-Relationship Diagram

Figure: Entity Relationship Diagram

Karman Arora Page 22 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

Lab 7 : Creating a Data Flow Diagram


Data Flow Diagram

A data flow diagram is a graphical representation of the flow of data through an information
system, modelling its process aspects. In the 1970s, Larry Constantine, the original developer of
structured design, proposed DFDs as a practical technique based on Martin and Estrin’s Data
Flow Graph model of computation. It became more popular in business circles, as it was applied
to business analysis, than in academic circles.

DFD can be made by 3 methods:

a. Gane & Sarson


b. Yourdon & Codd
c. Yourdon & DeMarco

Elements used in Data Flow Diagram

1. External Entity
2. Process
3. Data Flow
4. Data Store

Types of Data Flow Diagram

• Logical DFDs
• Physical DFDs

Karman Arora Page 23 of 37 03450402021


Example of a Data Flow Diagram:

Figure: Data Flow Diagram

Karman Arora Page 24 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

LAB 10: Software Metrics

Introduction to Halstead Software Metrics


Halstead’s software metrics is a set of measures proposed by Maurice Halstead to evaluate the
complexity of a software program. These metrics are based on the number of distinct operators
and operands in the program and are used to estimate the effort required to develop and maintain
the program.
The Halstead metrics include the following:
1. Program length (N): This is the total number of operator and operand occurrences in
the program. The length of the program in the terms of the total number of tokens used
is: (N = N1 + N2), where
N: program length
N1: total occurrences of operators
N2: total occurrences of operands

2. Vocabulary size (n): This is the total number of distinct operators and operands in the
program. (n = n1+ n2), where
n: vocabulary of a program
n1: number of unique operators
n2: number of unique operands

3. Program volume (V): This is the product of program length (N) and logarithm of
vocabulary size (n), i.e., V = N*log2(n).

4. Program level (L): This is the ratio of the number of operator occurrences to the number
of operand occurrences in the program, i.e., L = n1/n2, where n1 is the number of operator
occurrences and n2 is the number of operand occurrences.

5. Program difficulty (D): This is the ratio of the number of unique operators to the total
number of operators in the program, i.e., D = 1 / L

6. Program effort (E): This is the product of program volume (V) and program difficulty
(D), i.e., E = V*D.

Karman Arora Page 25 of 37 03450402021


Karman Arora Page 26 of 37 03450402021
Q. Find out the number of operators and operands, and calculate the values of:

a. Program Length (N)


b. Vocabulary Size (n)
c. Program Volume (V)

Calculation of operators and operands:

Operators Occurrences Operands Occurrences


int 4 sort 1
() 5 X 7
, 4 N 3
[] 7 I 8
if 2 J 7
< 2 save 3
; 11 im1 3
for 2 2 2
= 6 1 3
- 1 0 1
<= 2 --- ---
++ 2 --- ---
return 2 --- ---
{} 3 --- ---

14 N1 = 53 10 N2 = 38

Program Length=91

Vocabulary Size=24

Program Value=343.41

Karman Arora Page 27 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

LAB 11: Test Cases

Introduction to Test Case


A test case has components that describe input, action, and an expected response, in order to
determine if a feature of an application works correctly.

A test case is a set of instructions on “HOW” to validate a particular test objective/target, which,
when followed will tell us if the expected behaviour of the system is satisfied or not.

Example of a test case template:

Here, we are writing a test case for the IRCTC application module:

S. No. Precondition Test Scenario Test Test Case Test Steps Expected
Case ID Description Description Output

1 Access to To verify the TC_1 To verify the shape 1. Navigate to


Chrome logo of IRCTC and size of the logo https://irctc.com It should be
browser of square
shape of
2. See the shape approx. 2*2
and size of the cm in size
logo

TC_2 To verify the 1. Navigate to


position of the logo https://irctc.com It should be
at top left of
2. See the position the page
of the logo

2 Access to To verify links TC_3 To verify links of 1. Navigate to


Chrome Registration, https://irctc.com
browser Login, Booking
and Create User ID It should be
and Password in
in order
order

2. See the position


of the links

Karman Arora Page 28 of 37 03450402021


TC_4 To verify the font 1. Navigate to
and size of the https://irctc.com
links Size of links
should be
2. Check the size 16 and bold
and font of the
links

TC_5 To verify links are 1. Navigate to


in capital letters or https://irctc.com
not All links
should be in
2. Check whether capital
links are in capital
letters or not

TC_6 To verify the color 1. Navigate to


of links https://irctc.com
Registration, Login Color of
and Booking these three
links should
2. Check the color be black
of Registration,
Login, Booking

TC_7 To verify the color 1. Navigate to


of link "Create https://irctc.com
User ID and
Password" Color of this
link should
2. Check the color be red
of link "Create
User ID and
Password"

3 Access to To verify the TC_8 To verify the shape 1. Navigate to


Chrome picture of train and size of the https://irctc.com It should be
browser picture of rectangle
shape of
2. Check the shape 25*10 cm in
and size of train size
picture

TC_9 To verify the 1. Navigate to


position of the https://irctc.com It should be
picture
at the
bottom
2. See the position
of the picture

Karman Arora Page 29 of 37 03450402021


Programmer/Student Name: Shubham

Rastogi Enrolment Number: 35425502021

Course Name & Semester: BCA- 4th Semester

LAB 12: Mapping Design to code

Steps for Mapping Design to code in IBM Rational Rose:

1. Open Rational rose enterprise edition. Select J2EE on first prompt window.

Karman Arora Page 30 of 37 03450402021


2. In Logical view, create sample class diagram or select your class diagram.

3. In component view, create/select component diagram.

4. Right click on component diagram and select open specification.

Karman Arora Page 31 of 37 03450402021


5. Select Component name and select language as Java.

6. Go to tools menu, select options.

7. Under notations tab, select JAVA in default language, default notation must be selected as
Unified. Also select Visibility as icons checkbox.

Karman Arora Page 32 of 37 03450402021


8. Right click on component and select Java/J2EE, then select Generate code.

9. Select component 2 in class diagram and then right click to open specification.

Karman Arora Page 33 of 37 03450402021


10. In general tab, under type, select class from drop down list; In export control, select Private
radio button.

11. Now select class C3 and right click to open spectification.

12. Also select Private radio button for class C3.

Karman Arora Page 34 of 37 03450402021


13. Right click on C1 component in component diagram, select Java/J2EE and select Project
Specification.

14. In project specification, delete all files under Classpath Tab.

15. Now create new classpath: C:\JP1 and click :Reference Classpath button below.

Karman Arora Page 35 of 37 03450402021


16. Right click on component C1 in component diagram and open Java/J2EE and select Generate
code.

17. Assign classpath entries and select Ok.

18. Now create new classpath: “C:\JP1” and click: “Reference Classpath” button below. You will
see the dialog box-code generated successfully.

Karman Arora Page 36 of 37 03450402021


19. Go to my computer, C drive and go to folder JP1 where you will see the java source file. A
sample is given below:

Karman Arora Page 37 of 37 03450402021

You might also like