Software Engineering
Software Engineering
______________
Head of the External internal Examiner
Department Examiner Subject teacher
The purpose of class diagram is to model the static view of an application. Class diagrams
are the only diagrams which can be directly mapped with objectoriented languages and thus
widely used at the time of construction.
UML diagrams like activity diagram, sequence diagram can only give the sequence flow of
the application, however class diagram is a bit different. It is the most popular UML
diagram in the coder community. The purpose of the class diagram can be summarized as −
• Analysis and design of the static view of an application.
• Describe responsibilities of a system.
• Base for component and deployment diagrams.
• Forward and reverse engineering.
Attributes
+ Stands for public attributes # Stands
for protected attributes - Stands for
private attributes
Operations
+ Stands for public operations # Stands
for protected operations
PRACTICAL NO:-2
Aim: Study and implementation of Use Case Diagrams.
Theory: To model a system, the most important aspect is to capture the dynamic behaviour.
Dynamic behaviour means the behaviour of the system when it is running/operating.
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 the
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. Use case diagrams 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.
Hence to model the entire system, a number of use case diagrams are used.
The purpose of use case diagram is to capture the dynamic aspect of a system. However, this
definition is too generic to describe the purpose, as other four diagrams (activity, sequence,
collaboration, and State chart) also have the same purpose. We will look into some specific
purpose, which will distinguish it from other four diagrams.
Use case diagrams are used to gather the requirements of a system including internal and
external influences. These requirements are mostly design requirements. Hence, when a
system is analysed to gather its functionalities, use cases are prepared and actors are
identified.
When the initial task is complete, use case diagrams are modelled to present the outside
view.
In brief, the purposes of use case diagrams can be said to be as follows − • Used to
gather the requirements of a system.
• Used to get an outside view of a system.
• Identify the external and internal factors influencing the system.
• Show the interaction among the requirements are actors.
As we have already discussed there are five diagrams in UML to model the dynamic view of
a system. Now each and every model has some specific purpose to use. Actually these
specific purposes are different angles of a running system.
To understand the dynamics of a system, we need to use different types of diagrams. Use
case diagram is one of them and its specific purpose is to gather system requirements and
actors.
Use case diagrams can be used for −
• Requirement analysis and high level design.
• Model the context of a system.
• Reverse engineering.
• Forward engineering.
Diagram:
Practical No:-03
Purpose of ERD o The database analyst gains a better understanding of the data to be
contained in the database through the step of constructing the ERD.
o The ERD serves as a documentation tool. o Finally, the ERD is used to connect the
logical structure of the database to users. In particular, the ERD effectively communicates
the logic of the database to users.
Components of an ER Diagrams
1. Entity
An entity can be a real-world object, either animate or inanimate, that can be merely
identifiable. An entity is denoted as a rectangle in an ER diagram. For example, in a school
database, students, teachers, classes, and courses offered can be treated as entities. All these
entities have some attributes or properties that give them their identity.
Entity Set
An entity set is a collection of related types of entities. An entity set may include entities
with attribute sharing similar values. For example, a Student set may contain all the students
of a school; likewise, a Teacher set may include all the teachers of a school from all faculties.
Entity set need not be disjoint.
2. Attributes
Entities are denoted utilizing their properties, known as attributes. All attributes have values.
For example, a student entity may have name, class, and age as attributes.
There exists a domain or range of values that can be assigned to attributes. For example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc.
The association among entities is known as relationship. Relationships are represented by the
diamond-shaped box. For example, an employee works at a department, a student enrols in a
course. Here, Works at and Enrols are called relationships.
Relationship set
The number of participating entities in a relationship describes the degree of the relationship.
The three most common relationships in E-R models are:
1. Unary (degree1)
2. Binary (degree2) 3. Ternary (degree3) Diagram:
Practical No:-04
Actors – An actor in a UML diagram represents a type of role where it interacts with the
system and its objects. It is important to note here that an actor is always outside the scope of
the system we aim to model using the UML diagram.
Lifelines – A lifeline is a named element which depicts an individual participant in a
sequence diagram. So basically each instance in a sequence diagram is represented by a
lifeline. Lifeline elements are located at the top in a sequence diagram. The standard in UML
for naming a lifeline follows the following format – Instance Name : Class Name
• Asynchronous Messages – An asynchronous message does not wait for a reply from
the receiver. The interaction moves forward irrespective of the receiver processing the
previous message or not. We use a lined arrow head to represent an asynchronous
message.
• Create message – We use a Create message to instantiate a new object in the
sequence diagram. There are situations when a particular message call requires the
creation of an object. It is represented with a dotted arrow and create word labelled on
it to specify that it is the create Message symbol. For example – The creation of a new
order on a e-commerce website would require a new object of Order class to be
created.
• Self Message – Certain scenarios might arise where the object needs to send a
message to itself. Such messages are called Self Messages and are represented with a
U shaped arrow.
• Reply Message – Reply messages are used to show the message being sent from the
receiver to the sender. We represent a return/reply message using an open arrowhead
with a dotted line. The interaction moves forward only when a reply message is sent
by the receiver.
• Lost Message – A Lost message is used to represent a scenario where the recipient is
not known to the system. It is represented using an arrow directed towards an end
point from a lifeline. For example: Consider a scenario where a warning is generated.
Guards – To model conditions we use guards in UML. They are used when we need to
restrict the flow of messages on the pretext of a condition being met. Guards play an
important role in letting software developers know the constraints attached to a system or a
particular process.
For example: In order to be able to withdraw cash, having a balance greater than zero is a
condition that must be met as shown below.
Diagram:
Practical No:-05
Aim: Study and implementations of State Transition Diagrams.
Theory: The name of the diagram itself clarifies the purpose of the diagram and other
details. It describes different states of a component in a system. The states are specific to a
component/object of a system.
A Statechart diagram describes a state machine. State machine can be defined as a machine
which defines different states of an object and these states are controlled by external or
internal events.
Activity diagram explained in the next chapter, is a special kind of a Statechart diagram. As
Statechart diagram defines the states, it is used to model the lifetime of an object.
Statechart diagram is one of the five UML diagrams used to model the dynamic nature of a
system. They define different states of an object during its lifetime and these states are
changed by events. Statechart diagrams are useful to model the reactive systems. Reactive
systems can be defined as a system that responds to external or internal events.
Statechart diagram describes the flow of control from one state to another state. States are
defined as a condition in which an object exists and it changes when some event is
triggered. The most important purpose of Statechart diagram is to model lifetime of an
object from creation to termination.
Statechart diagrams are also used for forward and reverse engineering of a system. However,
the main purpose is to model the reactive system.
Following are the main purposes of using Statechart diagrams − • To
model the dynamic aspect of a system.
• To model the life time of a reactive system.
• To describe different states of an object during its life time.
• Define a state machine to model the states of an object.
Diagram:
Practical No:06
• Logical DFD - This type of DFD concentrates on the system process, and flow of data
in the system. For example in a Banking software system, how data is moved between
different entities.
• Physical DFD - This type of DFD shows how the data flow is actually implemented in
the system. It is more specific and close to the implementation.
DFD Components
DFD can represent Source, destination, storage and flow of data using the following set of
components -
• Level 0 - Highest abstraction level DFD is known as Level 0 DFD, which depicts the
entire information system as one diagram concealing all the underlying details. Level
0 DFDs are also known as context level DFDs.
• Level 1 - The Level 0 DFD is broken down into more specific, Level 1 DFD. Level 1
DFD depicts basic modules in the system and flow of data among various modules.
Level 1 DFD also mentions basic processes and sources of information.
• Level 2 - At this level, DFD shows how data flows inside the modules mentioned in
Level 1.
Higher level DFDs can be transformed into more specific lower level DFDs with
deeper level of understanding unless the desired level of specification is achieved.
Diagram:
Practical No:-07
Collaboration diagrams are created by first identifying the structural elements required to
carry out the functionality of an interaction. A model is then built using the relationships
between those elements. Several vendors offer software for creating and editing
collaboration diagrams.
• Each object in the collaboration is named and has its class specified
2. Actors- Actors are instances that invoke the interaction in the diagram. Each actor
has a name and a role, with one actor initiating the entire use case.
3. Links- Links connect objects with actors and are depicted using a solid line
between two elements. Each link is an instance where messages can be sent.
Links are defined as follows:
• An object interacts with, or navigates to, other objects through its links to these
objects.
The basic purposes of activity diagrams is similar to other four diagrams. It captures the
dynamic behaviour of the system. Other four diagrams are used to show the message flow
from one object to another but activity diagram is used to show message flow from one
activity to another.
Activity is a particular operation of the system. Activity diagrams are not only used for
visualizing the dynamic nature of a system, but they are also used to construct the
executable system by using forward and reverse engineering techniques. The only missing
thing in the activity diagram is the message part.
It does not show any message flow from one activity to another. Activity diagram is
sometimes considered as the flowchart. Although the diagrams look like a flowchart, they
are not. It shows different flows such as parallel, branched, concurrent, and single.
The purpose of an activity diagram can be described as − • Draw the
activity flow of a system.
• Describe the sequence from one activity to another.
• Describe the parallel, branched and concurrent flow of the system.
Before drawing an activity diagram, we should identify the following elements −
• Activities
• Association
• Conditions
• Constraints
Diagram: