Software Engineering Lab
Software Engineering Lab
List of Experiments
Software Engineering Lab (KCS-651)
Sl List of Experiments
Date
No.
1 To Develop requirement specification for given problem.
2 To Develop Use Case model for a given problem.
3
To Develop E-R diagram for a given problem.
To Develop DFD model (level-0, level-1 and data dictionary) of the
4
project.
LAB EXPERIMENT 1
OBJECTIVE:
Prepare an SRS document in line with the IEEE recommended standards.
BRIEF DESCRIPTION:
A software requirements specification (SRS) is a document that captures the complete description of
how the system is expected to perform. It is usually signed off at the end of requirements engineering
phase. Software requirements specification establishes the basis for an agreement between customers
and contractors or suppliers (in market-driven projects, these roles may be played by the marketing
and development divisions) on what the software product is to do as well as what it is not expected to
do. Software requirements specification permits a rigorous assessment of requirements before design
can begin and reduces later redesign. It should also provide a realistic basis for estimating product
costs, risks, and schedules.
EXPLANATION:
Step 1:
1. Introduction Identify the product whose software requirements are specified in this
document, including the revision or release number. Describe the scope of the product
that is covered by this SRS, particularly if this SRS describes only part of the system or a
single subsystem.
2. Intended Audience and Reading Suggestions
Describe the different types of reader that the document is intended for, such as
developers, project managers, marketing staff, users, testers, and documentation writers.
Describe what the rest of this SRS contains and how it is organized. Suggest a sequence
for reading the document, beginning with the overview sections and proceeding through
the sections that are most pertinent to each reader type.
3. Project Scope
Provide a short description of the software being specified and its purpose, including
relevant benefits, objectives, and goals. Relate the software to corporate goals or business
strategies. If a separate vision and scope document is available. Refer to it rather than
duplicating its contents here. An SRS that specifies the next release of an evolving
product should contain its own scope statement as a subset of the long-term strategic
product vision.
Step2:
1. Product Perspective
Describe the content and origin of the product being specified in this SRS. For example,
state whether this product is a follow-on member of a product family, a replacement for
certain existing systems, or a new, self-contained product. If the SRS defines a
component of a larger system, relate the requirements of the larger system to the
functionality of this software and identify interfaces between the two. A simple diagram
that shows the major components of the overall system, subsystem interconnections, and
external interfaces can be helpful.
2. Product Features
Summarize the major features the product contains or the significant functions that it
performs or lets the user perform. Only a high-level summary is needed here. Organize
the functions to make them understandable to any reader of the SRS. A picture of the
major groups of related requirements and how they relate. Such as a top level data flow
diagram or a class diagram is often effective.
3. User Classes and Characteristics
Identify the various user classes that you anticipate will use this product. User classes
may be differentiated based on the frequency of use, a subset of product functions used,
technical expertise, security or privilege levels, educational level, or experience. Describe
the pertinent characteristics of each user class. Certain requirements may pertain only to
certain user classes. Distinguish the favoured user classes from those who are less
important to satisfy.
4. Operating Environment
Describe the environment in which the software will operate, including the hardware
platform, operating system and versions, and any other software components or
applications with which it must peacefully coexist.
5. Design and Implementation Constraints
Describe any items or issues that will limit the options available to the developers. These
might include: corporate or regulatory policies; hardware limitations(timing
requirements, memory requirements); interfaces to other applications; specific
technologies, tools, and databases to be used; parallel operations; language requirements;
communications protocols; security considerations; design conventions or programming
standards (for example, if the customer’s organization will be responsible for maintaining
the delivered software).
Step 3:
1. System Features
This template illustrates organizing the functional requirements for the product by system
features, the major services provided by the product. You may prefer to organize this
section by use case, mode of operation, user class, object class, functional hierarchy, or
combinations of these, weather makes the most logical sense for your product.
1.1. System Feature 1
Don’t really say “System Feature 1.”State the feature name in just a few words.
1.1.1. Description and Priority
Provide a short description of the feature and indicate whether it is of High,
Medium, or Low priority. You could also include specific priority component
ratings, such as benefit, penalty, cost, and risk (each rated on a relative scale from
a low of 1 to a high of 9).
1.1.2. Stimulus/Response Sequences
List the sequences of user actions and system responses that stimulate the
behaviour defined for this feature. These will correspond to the dialogue elements
associated with use cases.
1.1.3. Functional Requirements
Itemize the detailed functional requirements associated with this feature. These
are the software capabilities that must be present in order for the user to carry out
the services provided by the feature, or to execute the use case, including how the
product should respond to an anticipated error condition or invalid inputs.
Requirements should be concise, complete, unambiguous, verifiable, and
necessary.
Step 4:
1. External Interface Requirements
1.1. User Interfaces
Describe the logical characteristics of each interface between the software product
and the users. This may include sample screen images, any GUI standards or
product family style guides that are to be followed, screen layout constraints,
standard buttons and function (e.g. , help)that will appear on every screen,
keyboard shortcuts, error message display standards, and so on. Define the
software components for which a user interface is needed. Details of the user
interface design should be documented in a separate user interface specification.
1.2. Hardware Interfaces
Describe the logical and physical characteristics of each interface between the
software product and the hardware components of the system. This may include
the supported device types, the nature of the data and control interactions between
the software and the hardware, and communication protocols to be used.
1.3. Software Interfaces
Describe the connections between this product and other specific software
components (name and version), including databases, operating systems, tools,
libraries, and integrated commercial components. Identify the data items or
messages coming into the system and going out and describe the purpose of each.
Describe the services needed and the nature of communications. Refer to
documents that describe detailed application programming interface protocols.
Identify data that will be shared across software components. If the data sharing
mechanism must be implemented in a specific way (for example, use of a global
data area in a multitasking operating system), specify this as an implementation
constraint.
1.4. Communications Interfaces
Specify the timing relationships for real-time systems. Make such requirements as
specific as possible. You may need to state performance requirements for
individual functional requirements or features.
2.2. Safety Requirements
Specify thaw requirements that are concerned with possible loss, damage, or harm
that could result from the use of the product. Define any safeguards or actions that
must be taken, as well as actions that must be prevented. Refer to any external
policies or regulations that state safety issues that affect the product's design or
use. Define any safety certifications that must be satisfied.
2.3. Security Requirements
Any requirements regarding security or privacy issues surrounding the use of the
product or protection of the data used or created by the product. Define any user
identity authentication requirements. Refer to any external policies or regulations
containing security issues that affect the product. Define any security or privacy
certifications that must be satisfied.
Software Quality Attributes
Specify any additional quality characteristics for the product that will be important to either the
customers or the developers. Some to consider are adaptability, availability, correctness,
LAB EXPERIMENT 2
OBJECTIVE:
To Develop Use Case model for a problem
BRIEF DESCRIPTION:
To model a system the most important aspect is to capture the dynamic behaviour. To clarify a
bit in details, dynamic behaviour means the behaviour of the system when it is running
/operating.
So only static behaviour is not sufficient to model a system rather dynamic behaviour is more
important than static behaviour. In UML there are five diagrams available to model dynamic
nature and 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. The diagram is used to model the system/subsystem of
an application. A single use case diagram captures a particular functionality of a system.
So to model the entire system numbers of use case diagrams are used.
PROCEDURE:
The steps are as follows:
Step1. Right Use Case Diagram on Diagram Nevigator and select New Use Case Diagram
from the pop-up menu
Step2.
Enter name for the newly created use case diagram in the text field of pop-up box on the top
left corner.
Step 3:
Drawing a system
To create a system, select System on the diagram toolbar and then click it on the
diagram pane. Finally. name the newly created system when it is created.
Step 4:
Drawing an actor
To draw an actor, select Actor on the diagram toolbar and then click it on the diagram
pane. Finally. name the newly created actor when it is created.
Step 5:
Drawing a use case
Besides creating a use case through diagram toolbar, you can also create it through resource
icon.
Mow the mouse over a shape and press a resource icon that can create use case. Drag it and
then release the mouse button until it reaches to your preferred place. The source shape and
the newly created use case are connected. Finally, name the newly created use case.
Step 6:
Create a use case through resource icon
Besides creating a use case through diagram toolbar, you can also create it through resource
icon. Mow the mouse over a shape and press a resource icon that can create use case. Drag it
and then release the mouse button until it reaches to your preferred place. The source shape
and the newly created use case are connected. Finally, name the newly created use case.
Step 7:
Resize a use case
To create an extend relationship, move the mouse over a use case and press its resource icon
Extend->
Use Case. Drag it to your preferred place and then release the mouse button. The use case
with extension points and a newly created use case are connected. After you name the newly
created use Pop up dialog box will ask whether you want the extension point to follow the
name of the use case. Click Yes if you want it to do so: click NO if you want to enter another
name for extension point.
Step 8:
Create an extend relationship
Drawing <<Include>> relationship
To create an include relationship. mouse over a use case and press its resource icon Include -
> Use Case. Drag it to your preferred place and then release the mouse button. A new use
case together with an include relationship is created. Finally, name the newly created use
case.
Step 9:
Step 10:
Create a package
Drag the mouse to create a package surrounding those use cases
Step 11:
Surround use cases with package
Finally, name the package
Step 12:
Name the package
Assigning IDs to actors/Use cases
You may assign IDs to actors and use cases. By default. IDs are assigned with the order of
object creation, starting from one onwards. However, you can define the format or even enter
an ID manually.
Defining the format of ID
To define the format of ID. select Tools > Options from the main menu to unfold the Options
dialog box. Select Diagramming from the list on the left hand side and select the Use Case
Diagram tab on the right hand side. You can adjust the format of IDs under Use Case
Diagram tab. The format of ID consists of prefix. number of digits and suffix.
Step 13:
Use Case Diagram tab
The description of options for ID generator format is shown below. Option Description
Prefix.The prefix you enter in Prefix text field will be inserted before the number.
Num :- The number of digits for the number. For example. when digit is 3. ID "1" will
become digits.
Suffix:-The suffix you enter in Suffix text field will be inserted behind the number. Options
for formatting ID
Showing ID on diagram
By default, ID is just a text property. It usually doesn't appear on diagram. However, you can
make it shown within a use case.
Right click on the diagram background, select Presentation Options and the specific model
element display option from the pop-up menu.
Step 14:
Show ID on diagram
As a result, the use case is displayed with ID.
Step 15:
1. Click Business model
2. After selected , an extra slashwill be shown on the left edge of the use case.
Business Model
And Finally the Use Case Diagram is ready.
LAB EXPERIMENT 3
OBJECTIVE:
To Develop E-R diagram for a given problem.
BRIEF DESCRIPTION:
ER-modeling is a data modeling technique used in software engineering to produce a conceptual data
model of a information system. Diagrams created using this ER-modeling technique are called
Entity-Relationship Diagrams, or ER diagrams or ERDs. So you can say that Entity Relationship
Diagrams illustrate the logical structure of databases.
PROCEDURE:
Entity-relationship diagrams are incredibly useful, and you can easily create one of your own by
following these simple steps.
1. Determine the entities: Entities are typically nouns such as car, bank, student, or
product.
In an ER Diagram, entities are the most important parts. To proceed, we will be creating a
conceptual ER diagram of a simple system in which a student registers for a course that is taught
by a professor. Check out this awesome tutorials to review ER Diagram Shapes. In this example,
the three entities are “Student,” “Course,” and “Professor.”
2. Identify the relationships: Relationships highlight how entities interact with each
other.
Relationships are typically verbs such as “buys,” “contains,” or “does.” In our example, the
relationships “Registers for” and “Teaches” effectively explain the interactions between the three
entities.
In an ER Diagram, attributes are necessary to model what characteristics will be included with
each entity. Attributes such as “IDNumber,” “Name,” and “SKU” are common attributes.
Organizing the ERD in a logical way is incredibly important to increase comprehension. The
main purpose of entity-relationship diagrams is to model a complex database, so learning how to
create simple, logical ERDs is key.
LAB EXPERIMENT 4
OBJECTIVE:
To Develop DFD model (level-0, level-1 and data dictionary) of the project.
BRIEF DESCRIPTION:
Data drive business activities and can trigger events (e.g. new sales order data) or be processed
to provide information about the activity. Data flow analysis. as the name suggests, follows the
flow of data through business processes and determines how organization objectives are
accomplished. In the course of handling transactions and completing tasks, data are input,
processed. Stored, retrieved, met changed and stored output. Data flow analysis studies the use of
data in each activity and documents the findings in data flow diagrams, graphically showing the
relation between processes and data.
PROCEDURE:
Physical and Logical DFDs
There are two types of data flow diagrams, namely physical data flow diagrams and logical data
flow diagrams and it is important to distinguish clearly between the two:
Physical Data Flow Diagrams
An implementation-dependent view of the current system, showing what tasks are carried out
and how they are performed. Physical characteristics can include Names of people, Form and
document names or numbers Names of departments, Master and transaction files, Equipment and
devices used.
Logical Data Flow Diagrams
An implementation-independent view of the system, focusing on the flow of data between
processes without regard for the specific devices, storage locations or people in the system. The
physical characteristics listed above for physical data flow diagrams will not be specified.
Here, two examples of data flow that describe input and validation of data are considered. In
e.g. the two processes are directly connected by a data flow. This means that the 'validate-
number' process can start only after the 'read-number' process had supplied data to it.
However in Fig (c), the two processes are connected through a data store. Hence, the
operations of the two bubbles are independent. The first one is termed 'synchronous' and the
second one 'asynchronous'.
Importance of DFDs in a good software design
The main reason why the DFD technique is so popular is probably because of the fact that
DFD is a very simple formalism - it is simple to understand and use. Starting with a set of
high-level functions that a system performs, a DFD model hierarchically represents various
sub-functions. In fact, any hierarchical model is simple to understand. Human mind is such
that it can easily understand any hierarchical model of a system - because in a hierarchical
model. Starting with a very simple and abstract model of a system, different details of the
system are slowly introduced through different hierarchies. The data flow diagramming
technique also follows a very simple set of intuitive concepts and rules. DFD is an elegant
modeling technique that turns out to be useful not only to represent the results of structured
analysis of a software problem. but also for several other applications such as showing the
flow of documents or items in an organization.
Data dictionary
A data dictionary lists all data items appearing in the DFD model of a system. The data items
listed include all data flows and the contents of all data stores appearing on the DFDs in the
DFD model of a system. A data dictionary lists the purpose of all data items and the definition
of all composite data items in terms of their component data items. For example, a data
dictionary entry may represent that the data gross Pay consists of the components regular Pay
and overtime pay. gross Pay = regular Pay + overtime Pay +: denotes For the smallest units of
data items, the data dictionary lists their name and their type. Composite data items can be
defined in terms of primitive data items using the following data definition operators:
Composition of two data items, e.g. a+b represents data a and b.
LA: represents selection, i.e. any one of the data items listed in the brackets can occur. For
example, [Lb] represents either a occurs or b occurs.=: represents equivalence, e.g. a=b+c
means that a represents b and c.
/* */: Anything appearing within /* and */ is considered as a comment.
Balancing a DFD
The data that flow into or out of a bubble must match the data flow at the next level of
DFD. This is known as balancing a DFD. The concept of balancing a DFD has been
illustrated in figure below. In the level I of the DFD, data 0: the contents inside the bracket
represent optional data which may or may not appear. E.g. a+ (b) represents either a occurs or
a+b occurs.{}: represents iterative data definition, e.g. { name}5 represents five name data.
{name}* represents zero or more instances of name data.
Items dl and d3 flow out of the bubble 0.1 and the data item d2 flows e O. I. In the next
level, bubble 0.1 is decomposed. The dec3 flow out of the level 2diagram and d2 flows.
Level 1 DFD
Level 2 DFD
If a system has more than 7 high- level functional requirements then some of the related
requirements have to be combined and represented in the form of a bubble in the level I DFD.
Such a bubble can be split in the lower DFD levels. If a system has less than three high-level
functional requirements then some of them need to be split into their sub-functions so that we
have roughly about 5 to 7 bubbles on the diagram.
Decomposition:-
Each bubble in the DFD represents a function performed by the system. The bubbles are
decomposed into sub-functions at the successive levels of the DFD.
Decomposition of a bubble is also known as factoring or exploding a bubble. Each bubble at
any level of DFD is usually decomposed to anything between 3 to 7 bubbles. Too few bubbles
at any level make that level superfluous. For example, if a bubble is decomposed to just one
bubble or two bubbles, then this decomposition becomes redundant. Also, too many bubbles,
i.e. more than 7 bubbles at any level of a DFD makes the DFD model hard to understand.
Decomposition of a bubble should be carried on until a level is reached at which the function
of the bubble can be described using a simple algorithm.
Numbering of Bubbles:-
It is necessary to number the different bubbles occurring in the DFD. These numbers help in
uniquely identifying any bubble in the DFD by its bubble number. The bubble at the context
level is usually assigned the number 0 to indicate that it is the 0 level DFD. Bubbles at level 1
are numbered, 0.1, 0.2, 0.3, etc, etc. When a bubble numbered x is decomposed, its children
bubble are numbered x.1, xi, x.3, etc. In this numbering scheme, by looking at the number of a
bubble we can unambiguously determine its level, its ancestors, and its successors.
Example:-
Supermarket needs to develop the following software to encourage regular customers. For
this, the customer needs to supply his/her residence address, telephone number, and the
driving license number. Each customer who registers for this scheme is assigned a unique
customer number (CN) by the computer. A customer can present his CN to the check out staff
when he makes any purchase. In this case, the value of his purchase is credited against his
CN. At the end of each year, the supermarket intends to award surprise gifts to 10 customers
who make the highest total purchase over the year. Also, it intends to award a 22 carat gold
coin to every customer whose purchase exceeded Rs.10,000. The entries against the CN are
the reset on the day of every year after the prize winners' lists are generated.
LAB EXPERIMENT 5
OBJECTIVE:
To Develop Sequence diagram for a specific problem.
BRIEF DESCRIPTION:
From the name Interaction it is clear that the diagram is used to describe some type of
interactions among the different elements in the model. So this interaction is a part of dynamic
behaviour of the system.
This interactive behaviour is represented in UML by two diagrams known as Sequence diagram
and Collaboration diagram. The basic purposes of both the diagrams are similar.
Sequence diagram emphasizes on time sequence of messages and collaboration diagram
emphasizes on the structural organization of the objects that send and receive messages.
PROCEDURE:
A sequence diagram is used primarily to show the interactions between objects that are
represented as lifelines in a sequential order.
Step 1:
Right dick Sequence diagram on Diagram Navigator and select New Sequence Diagram from the
pop-up menu to create a sequence diagram.
Step 2:
Enter name for the newly created sequence diagram in the text field of pop-up box on
the top left corner. Creating actor
To create actor, click Actor on the diagram toolbar and then click on the diagram.
Creating lifeline
To create lifeline, you can click LifeLine on the diagram toolbar and then click on the diagram.
Alternatively, a much quicker and more efficient way is to use the resource-centric interface.
Click on the Message -> LifeLine resource beside an actor/lifeline and drag
Step 3:
Move the mouse to empty space of the diagram and then release the mouse button. A new
lifeline will be created and connected to the actor/lifeline with a message.
Step 4:
Using sweeper and magnet to manage sequence diagram
Sweeper helps you to move shapes aside to make room for new shapes or connectors. To use
sweeper, click Sweeper on the diagram toolbar (Under the tool category)
The picture below shows the message specify visit time is being swept downwards, thus new
room is made for new messages.
Step 5:
You can also use magnet to pull shapes together. To use magnet, click Magnet on the diagram
toolbar ( under the Tools category)
Magnet -Click on empty space of the diagram and drag towards top, right. bottom or left. Shapes
affected will be pulled to the direction you dragged. The picture below shows when drag the
magnet upwards, shapes below dragged position are pulled upwards.
Step 6:
Creating combined fragment for messages
To create combined fragment to cover messages, select the messages. right-click on the selection
and select Create Combined Fragment. and then select a combined fragment type (e.g. loop)
from the popup menu
Step 7:
A combined fragment of selected type will be created to cover the messages.
Step 8:
Adding/removing covered lifelines
1. After you've created a combined fragment on the messages. you can add or remove the
covered lifelines. Move the mouse over the combined fragment and select Add/Remove
Covered Lifeline... from the pop-up menu..
2. In the Add/Remove Covered Lifelines dialog box, check the lifeline you want to cover
or uncheck the lifeline you don’t want to cover. Click OK button.
3. As a result, the area of covered lifelines is extended or narrowed down according to your
selection.
Managing Operands
After you've created a combined fragment on the messages, you can also add or remove
operand(s).
Move the mouse over the combined fragment and select Operand > Manage Operands... from the
pop-up menu.
Step 9:
To remove an operand , select the target operand from Operands and click Remove button,
1. Click Ok button.
2. Otherwise, click Add button to add a new operand and then name it. Click OK button.
In sequence diagram, an editor appears at the bottom of diagram by default, which enables
you to construct sequence diagram with the buttons there.
The shortcut keys assigned to the buttons provide a way to construct diagram through
keyboard. Besides constructing diagram, you can also excess diagram elements listing in the
editor.
There are two panes, Lifelines and Messages. The Lifelines pane enables you to create different
kinds of actors and lifelines.
Step 10:
Buttons in Lifeline Panes
Editing Messages
The Message pane enables you to connect with various kind of messages.
Step 11:
If you choose Single Level. all sequence messages will be ordered with integers on diagram
base. On the other hand, if you choose Nested Level. all sequence messages will be ordered with
decimal place on diagram base.
Right click on the diagram's background. select Sequence Number and then either Fnune-
based Single Level or Frame-based Nested Level from the pop-up menu.
When you set the way of numbering sequence messages on frame base, the sequence messages
in frame will restart numbering sequence message since they are independent and ignore the way
of numbering sequence message outside the frame.
LAB EXPERIMENT 6
OBJECTIVE:
To Develop Class diagram for a problem.
BRIEF DESCRIPTION:
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.
PROCEDURE:
Step 1:
Right click Class Diagram on Diagram Navigator and select New Class Diagram from
the pop-up menu to create a clam diagram.
Step 2:
Creating class
To create class, click Class on the diagram toolbar and then click on the diagram. Class will be
created.
Creating association
To create association from class, click the Association •> Class resource beside it and drag
Drag to empty space of the diagram to create a new class, or drag to an existing class to connect
to it. Release the mouse button to create the association
Step 3:
To alit multiplicity of an association end, right-click near the association end, select
Multiplicityfrom the popup menu and then select a multiplicity.
To show the direction of an association, right click on it and select Presentation Options
>Show Direction from the pop-up menu.
Step 4:
The direction arrow is shown beside the association
Creating generalization
To create generalization from class, click the Generalization -> Class resource beside it and drag.
Drag to empty space of the diagram to create a new class, or drag to an existing class to connect
to it. Release the mouse button to create the generalization.
An operation is created,
Similar to creating attribute, you can press the Enter key to create multiple operations
continuously. Drag-and-Drop reordering, copying and moving of class members
To reorder a class member, select it and drag within the compartment, you will see a thick black
line appears indicating where the class member will be placed.
To copy a class member, select it and drag to the target class while keep pressing the Ctrl key,
you will see a thick black line appears indicating where the class member will be placed. A plus
sign is shown beside the mouse cursor indicating this is a copy action
To move a class member, select it and drag to the target class, you will see a thick black line
appears indicating where the class member will be placed. Unlike copy, do not press the
Ctrl key when drag, the mouse cursor without the plus sign indicates this is a move action.
Press up or down key to select class in the list, press Enter to confirm. Upon selecting an existing
class, all class members and relationships are shown immediately.
Step 5:
Continue to complete the diagram
Generalization set
A generalization set defines a particular set of generalization relationships that describe the way
in which a general classifier (or superclass) may be divided using specific subtypes.
To define a generalization set, select the generalizations to include, right click and select
Generalization set > Create Generalization Set...from the popup menu.
Step 6:
Name the set in the Manage Generalization Sets dialog box, and confirm by pressing OK.
The selected generalizations are grouped. Adjust the connector to make the diagram tidy.
LAB EXPERIMENT 7
OBJECTIVE:
Draw the state chart diagram
BRIEF DESCRIPTION:
A state diagram, also called a state machine diagram or state chart diagram, is an illustration of
the states an object can attain as well as the transitions between those states in the Unified
Modeling Language (UML). In this context, a state defines a stage in the evolution or behavior
of an object, which is a specific entity in a program or the unit of code representing that entity.
State diagrams are useful in all forms of object-oriented programming (OOP)..
A state represents a condition during the life of an object during which it satisfies some condition
or waits for some event. Start and end states represent the beginning or ending of a process. A
state transition is a relationship between two states that indicates when an object can move the
focus of control on to another state once certain conditions are met. In a statechart diagram, a
transition to self-element is similar to a state transition. However, it does not move the focus of
control. A state transition contains the same source and target state.
PROCEDURE:
Step 1: Creating state machine diagram
Perform the steps below to create a UML state machine diagram in Visual Paradigm.
1. Select Diagram > New from the application toolbar.
2. In the New Diagram window, select State Machine Diagram.
3. Click Next.
4. Enter the diagram name and description. The Location field enables you to select a
model to store the diagram.
5. Click OK.
Step 2:Creating states and transitions
After creating a state machine diagram, an initial pseudo state appears by default. You can create
other states by using Resource Catalog:
1. Move your mouse pointer over the source state.
2. Press on the Resource Catalog button and drag it out.
To create a state
5. A new state will be created and is transited from the source state. Enter its name and press
Enter to confirm editing.
State created
Step 3: Adding region to state
To model substates of a composite state, you need to add one or more regions to it. To add a
region, right-click the state and select Add Horizontal Region from the popup menu.
LAB EXPERIMENT 8
PROCEDURE:
1. Initial State – The starting state before an activity takes place is depicted using the initial
state.
A process can have only one initial state unless we are depicting nested activities. We use
a black filled circle to depict the initial state of a system. For objects, this is the state
when they are instantiated. The Initial State from the UML Activity Diagram marks the
entry point and the initial Activity State.
For example – Here the initial state is the state of the system before the application is
opened.
For example – Consider the previous example of opening an application opening the
application is an activity state in the activity diagram.
An activity state can have multiple incoming and outgoing action flows. We use a line
with an arrow head to depict a Control Flow. If there is a constraint to be adhered to
while making the transition it is mentioned on the arrow.
Consider the example – Here both the states transit into one final state using action flow
symbols i.e. arrows.
4. Decision node and Branching – When we need to make a decision before deciding the
flow of control, we use the decision node.
The outgoing arrows from the decision node can be labelled with conditions or guard
expressions.It always includes two or more output arrows.
The statement must be true for the control to shift along a particular direction. Guards
help us know the constraints and conditions which determine the flow of a process.
When we use a fork node when both the activities get executed concurrently i.e. no
decision is made before splitting the activity into two parts. Both parts need to be
executed in case of a fork statement.
We use a rounded solid rectangular bar to represent a Fork notation with incoming arrow
from the parent activity state and outgoing arrows towards the newly created activities.
For example: In the example below, the activity of making coffee can be split into two
concurrent activities and hence we use the fork notation.
7. Join – Join nodes are used to support concurrent activities converging into one. For join
notations we have two or more incoming edges and one outgoing edge.
For example – When both activities i.e. steaming the milk and adding coffee get
completed, we converge them into one final activity.
8. Merge or Merge Event – Scenarios arise when activities which are not being executed
concurrently have to be merged. We use the merge notation for such scenarios. We can
merge two or more activities into one if the control proceeds onto the next activity
irrespective of the path chosen.
For example – In the diagram below: we can’t have both sides executing concurrently,
but they finally merge into one. A number can’t be both odd and even at the same time.
9. Swimlanes – We use swimlanes for grouping related activities in one column. Swimlanes
group related activities into one column or one row. Swimlanes can be vertical and
horizontal. Swimlanes are used to add modularity to the activity diagram. It is not
mandatory to use swimlanes. They usually give more clarity to the activity diagram. It’s
similar to creating a function in a program. It’s not mandatory to do so, but, it is a
recommended practice.
For example – Here different set of activities are executed based on if the number is odd
or even. These activities are grouped into a swimlane.
We can have a scenario where an event takes some time to complete. We use an
hourglass to represent a time event.
For example – Let us assume that the processing of an image takes takes a lot of time.
Then it can be represented as shown below.
11. Final State or End State – The state which the system reaches when a particular process
or activity ends is known as a Final State or End State. We use a filled circle within a
circle notation to represent the final state in a state machine diagram. A system or a
process can have multiple final states.
ctivity diagrams are mainly used as a flowchart that consists of activities performed by the
system. Activity diagrams are not exactly flowcharts as they have some additional capabilities.
These additional capabilities include branching, parallel flow, swimlane, etc.
Before drawing an activity diagram, we must have a clear understanding about the elements used
in activity diagram. The main element of an activity diagram is the activity itself. An activity is a
function performed by the system. After identifying the activities, we need to understand how
they are associated with constraints and conditions.
Activities
Association
Conditions
Constraints
Once the above-mentioned parameters are identified, we need to make a mental layout of the
entire flow. This mental layout is then transformed into an activity diagram.
Following is an example of an activity diagram for order management system. In the diagram,
four activities are identified which are associated with conditions. One important point should be
clearly understood that an activity diagram cannot be exactly matched with the code. The activity
diagram is made to understand the flow of activities and is mainly used by the business users
After receiving the order request, condition checks are performed to check if it is normal or
special order. After the type of order is identified, dispatch activity is performed and that is
marked as the termination of the process.
LAB EXPERIMENT 9
PROCEDURE:
1.Select Tools > Code > Instant Reverse… from the toolbar.
3.Add the file or folder path of source by clicking on the appropriate Add button at the right hand
side of the window. There are four kinds of supported sources: Jar file, class folder, a zip of
source or a folder of source files.
4.By default an on-demand reverse engineering will be carried out, which means to form indexes
to the added path(s) instead of actually reversing them. For details about on demand reverse
engineering, refer to the section below. If you want to carry out actual reverse engineering,
uncheck Reverse source on demand.
6.Upon finishing, the class repository will be popped up, listing the reversed classes (or indexes
of classes if you are running an on-demand reverse engineering).Note: By cancelling from
forming diagram, it just means you do not want to form diagram with the reversed classes for the
time being. You can still look for the classes in Model Explorer or Class Repository, and
possibly form diagram later on manually.
Consider if you have a zip file that contains million of Java source file, like the file src.zip
of Java Development Kit (JDK), and now you want to make the class java.util.Collection appear
as UML class so that you can extend it when developing your own collection framework. Now,
if you try to reverse the zip file it will take you a long time to complete the reverse due to the
amount of classes (and relationships) is just too many. With on-demand reverse engineering, you
will reverse the sources as indexes, and obtain an index tree in class repository. No actual UML
classes will be reversed until you trigger the reverse manually. This reduces the processing time
significantly.
To perform on-demand reverse engineering, make sure the option Reverse source on demand is
checked in the Instant Reverse window.
When finished instant reverse, you can lookup the index tree in class repository. Then, right click
on the class you want to reverse and select Reverse Resources to where Resources are the
classes you have selected, and select either New Class Diagram or Class Repository from
popup menu. Both options will result in reversing the selection to UML classes, while the
option New Class Diagram will create a class diagram and place the classes in it.