2nd Assignments Withs Answers
2nd Assignments Withs Answers
• Initial states: The starting stage before an activity takes place is depicted as
the initial state
• Final states: The state which the system reaches when a specific process
end is known as a Final State
• State or an activity box:
• Decision box: It is a diamond shape box which represents a decision with
alternate paths. It represents the flow of control.
Component Diagram
Basic Component Diagram Symbols and Notations
Component
A component is a logical unit block of the system, a slightly higher abstraction
than classes. It is represented as a rectangle with a smaller rectangle in the
upper right corner with tabs or the word written above the name of the
component to help distinguish it from a class.
Interface
An interface (small circle or semi-circle on a stick) describes a group of
operations used (required) or created (provided) by components. A full circle
represents an interface created or provided by the component. A semi-circle
represents a required interface, like a person's input.
Dependencies
Port
Ports are represented using a square along the edge of the system or a
component. A port is often used to help expose required and provided interfaces
of a component.
Answer
State machine
• A state machine is a behaviour that specifies the sequences of states an
object goes through during its lifetime in response to events.
• Graphically, a state is rendered as a rectangle with rounded corners. A
transition is rendered as a solid directed line.
• State machines are used to specify the behaviour of objects that must
respond to asynchronous stimulus or whose current behaviour depends
on their past.
• State machines are used to model the behaviour of entire systems,
especially reactive systems, which must respond to signals from actors
outside the system.
Ques 5. What do you mean by event? What are the types of events
explain with example?
Answer
Events
Types of Events
Signals
A signal is a named object that is sent asynchronously by one object and then
received by another. Exceptions are the famous examples for signals. A signal
may be sent as the action of a state in a state machine or as a message in an
interaction. The execution of an operation can also sends signals.
In UML, we model the relationship between an operation and the events using
a dependency stereotyped with “send”, which indicates that an operation sends
a particular signal.
Call Events
A call event represents the dispatch of an operation from one object to another.
A call event may trigger a state change in a state machine. A call event, in
general, is synchronous.
This means that the sender object must wait until it gets an acknowledgment
from the receiver object which receives the call event. For example, consider
the states of a customer in an ATM application:
Time and Change Events
A time event represents the passage of time. In UML, we model the time event
using the “after” keyword followed by an expression that evaluates a period of
time.
OR
Answer
The three types of modeling in UML are as follows:
1. Structural modeling:
- It captures the static features of a system.
- It consists of the following diagrams:
1. Classes diagrams
2. Objects diagrams
3. Deployment diagrams
4. Package diagrams
5. Composite structure diagram
6. Component diagram
- This model represents the framework for the system and all the components
exist here.
- It represents the elements and the mechanism to assemble them.
- It never describes the dynamic behaviour of the system.
2. Behavioural modeling:
- It describes the interaction within the system.
- The interaction among the structural diagrams is represented here.
- It shows the dynamic nature of the system.
- It consists of the following diagrams:
1. Activity diagrams
2. Interaction diagrams
3. Use case diagrams
- These diagrams show the dynamic sequence of flow in the system.
3. Architectural modeling:
- It represents the overall framework of the system.
- The structural and the behaviour elements of the system are there in this
system.
- It is defined as the blue print for the entire system.
- Package diagram is used.
OR
Answer
Architectural Modeling
Architectural model represents the overall framework of the system. It contains
both structural and behavioural elements of the system. Architectural models
can be defined as the blueprint of the entire system. Package diagram comes
under architectural modeling.
As stated earlier, architecture can be defined at both a logical and physical level.
You will recall that the logical architecture is the more generic view of the
architecture and how it works with less technical specificity.
The physical architecture, on the other hand, describes in more detail how
the software and systems are designed, including specifics about how the
architecture must fit into different technologies that exist within the organization
and how the software integrates with itself and with other systems. We use
several modeling elements and techniques to describe the physical architecture
Component Diagrams
Components are made up of one or more classes and describe parts of an
application that can be assembled and reused.
A component-based architecture (CBD) is the design of a software system
made up of multiple components. For efficiency, it is important to develop
software based on multiple smaller parts (components), which you can use to
assemble the overall system. This enables you to reuse software components
instead of writing them all from scratch.
Component-based architecture also enables different teams to work on the
software and plug their pieces together using what are called “interfaces.” An
interface is a named set of operations that enable the components to work
together through this interface code.
Interfaces enable you to get and provide information to and from a component
using code specific to the technology on which it is deployed. Figure 4-12 shows
how a component and interface are displayed on a component diagram. The
interface is displayed as a circle, but it can also be displayed as a typical class
with the stereotype of <<interface>>.
Deployment Diagrams
Deployment diagrams represent the runtime architecture of your system. A
deployment diagram can be made up of nodes that represent a piece of hard-
ware that generally has memory and a processor built in. There are two different
types of nodes: processor and device. Figure 4-14 shows what the deployment
diagram elements look like.
OR
Answer
UML Collaboration Diagram
The collaboration diagram is used to show the relationship between the objects
in a system. Both the sequence and the collaboration diagrams represent the
same information but differently. Instead of showing the flow of messages, it
depicts the architecture of the object residing in the system as it is based on
object-oriented programming. An object consists of several features. Multiple
objects present in the system are connected to each other. The collaboration
diagram, which is also known as a communication diagram, is used to portray
the object's architecture in the system.
Notations of a Collaboration Diagram
Following are the components of a component diagram that are enlisted below:
OR
OR
Answer
A generalization is a relationship between a general kind of thing (called the
superclass or parent) and a more specific kind of thing (called the subclass or
child). Generalization is sometimes called an "is-a-kind-of" relationship: one
thing (like the class Bay Window) is-a-kind-of a more general thing (for example,
the class Window). An object of the child class may be used for a variable or
parameter typed by the parent, but not the reverse.
In other words, generalization means that the child is substitutable for a
declaration of the parent. A child inherits the properties of its parents, especially
their attributes and operations. Often but not always the child has attributes and
operations in addition to those found in its parents. An implementation of an
operation in a child overrides an implementation of the same operation of the
parent; this is known as polymorphism. To be the same, two operations must
have the same signature (same name and parameters). Graphically,
generalization is rendered as a solid directed line with a large unfilled triangular
arrowhead, pointing to the parent, as shown in Figure. Use generalizations
when you want to show parent/child relationships.
Figure. Generalization
A class may have zero, one, or more parents. A class that has no parents and
one or more children is called a root class or a base class. A class that has no
children is called a leaf class. A class that has exactly one parent is said to use
single inheritance; a class with more than one parent is said to use multiple
inheritance.
Most often, you will use generalizations among classes and interfaces to show
inheritance relationships. In the UML, you can also create generalizations
among other kinds of classifiers, such as nodes.
OR
Answer
Package diagrams are structural diagrams used to show the organization and
arrangement of various model elements in the form of packages. A package is
a grouping of related UML elements, such as diagrams, documents, classes, or
even other packages. Each element is nested within the package, which is
depicted as a file folder within the diagram, then arranged hierarchically within
the diagram. Package diagrams are most commonly used to provide a visual
organization of the layered architecture within any UML classifier, such as a
software system.
• They provide a clear view of the hierarchical structure of the various UML
elements within a given system.
• These diagrams can simplify complex class diagrams into well-ordered
visuals.
• They offer valuable high-level visibility into large-scale projects and
systems.
• Package diagrams can be used to visually clarify a wide variety of
projects and systems.
• These visuals can be easily updated as systems and projects evolve.
Basic components of a package diagram
The makeup of a package diagram is relatively simple. Each diagram includes
only two symbols:
Symbol
Symbol Image Description
Name
Groups common
elements based on
Package
data, behavior, or user
interaction
Ques 11. Write a short note on use case diagram and time diagram with
suitable diagram and their utility in system design.
Answer
1. Use Case Diagram captures the system's functionality and requirements
by using actors and use cases. Use Cases model the services, tasks,
function that a system needs to perform. Use cases represent high-level
functionalities and how a user will handle the system. Use-cases are the
core concepts of Unified Modelling language modeling.
2. Timing diagrams
Timing diagrams focus on conditions changing within and among lifelines along
a linear time axis. Timing Diagrams describe behaviour of both individual
classifiers and interactions of classifiers, focusing attention on time of
occurrence of events causing changes in the modeled conditions of the
Lifelines.
Following are some important key points of a timing diagram:
1. It emphasizes at that particular time when the message has been sent
among objects.
2. It explains the time processing of an object in detail.
3. It is employed with distributed and embedded systems.
4. It also explains how an object undergoes changes in its form throughout
its lifeline.
5. As the lifelines are named on the left side of an edge, the timing diagrams
are read from left to right.
6. It depicts a graphical representation of states of a lifeline per unit time.
7. In UML, the timing diagram has come up with several notations to simplify
the transition state among two lifelines per unit time.
Ques 12. Discuss in brief basic behavioral modelling?
OR
Answer
UML behavioral diagrams visualize, specify, construct, and document the
dynamic aspects of a system. The behavioral diagrams are categorized as
follows: use case diagrams, interaction diagrams, state–chart diagrams, and
activity diagrams.
Behavioral Model is specially designed to make us understand behavior and
factors that influence behavior of a System. Behavior of a system is explained
and represented with the help of a diagram. This diagram is known as State
Transition Diagram. It is a collection of states and events. It usually describes
overall states that a system can have and events which are responsible for a
change in state of a system.
So, on some occurrence of a particular event, an action is taken and what action
needs to be taken is represented by State Transition Diagram.
Example :
Consider an Elevator. This elevator is for n number of floors and has n number
of buttons one for each floor.
Elevator’s working can be explained as follows:
• Elevator buttons are type of set of buttons which is there on elevator. For
reaching a particular floor you want to visit, “elevator buttons” for that
particular floor is pressed. Pressing, will cause illumination and elevator
will start moving towards that particular floor for which you pressed
“elevator buttons”. As soon as elevator reaches that particular floor,
illumination gets cancelled.
• Floor buttons are another type of set of buttons on elevators. If a person
is on a particular floor and he wants to go on another floor, then the
elevator button for that floor is pressed. Then, process will be same as
given above. Pressing will cause illumination and elevator to start moving,
and when it reaches on desired floor, illumination gets canceled.
• When there is no request for elevator, it remains closed on current floor.
State Transition Diagram for an elevator system is shown below –
Advantages :
• This model does not have any theory, so trainee is not able to fully
understand basic principle and major concept of modeling.
• This modeling cannot be fully automated.
• Sometimes, it’s not easy to understand overall result.
• Does not achieve maximum productivity due to some technical issues or
any errors.
Answer
Class
A class represents a collection of objects having the same characteristic
properties that exhibit common behavior. It gives the blueprint or description of
the objects that can be created from it. Creation of an object as a member of a
class is called instantiation. Thus, an object is an instance of a class.
The constituents of a class are −
• A set of attributes for the objects that are to be instantiated from the class.
Generally, different objects of a class have some difference in the values
of the attributes. Attributes are often referred to as class data.
• A set of operations that portray the behavior of the objects of the class.
Operations are also referred to as functions or methods.
Example
Let us consider a simple class, Circle, that represents the geometrical figure
circle in a two–dimensional space. The attributes of this class can be identified
as follows −
Answer
Relationships in Class Diagrams
Classes are interrelated to each other in specific ways. In particular,
relationships in class diagrams include different types of logical connections.
The following are such types of logical connections that are possible in UML:
• Association
• Directed Association
• Reflexive Association
• Multiplicity
• Aggregation
• Composition
• Inheritance/Generalization
• Realization
Association
Association
is a broad term that encompasses just about any logical connection or
relationship between classes. For example, passenger and airline may be
linked as above:
Directed Association
Directed Association
refers to a directional relationship represented by a line with an arrowhead. The
arrowhead depicts a container-contained directional flow.
Reflexive Association
Reflexive Association
This occurs when a class may have multiple functions or responsibilities. For
example, a staff member working in an airport may be a pilot, aviation engineer,
a ticket dispatcher, a guard, or a maintenance crew member. If the maintenance
crew member is managed by the aviation engineer there could be a managed
by relationship in two instances of the same class.
Multiplicity
Composition
Inheritance / Generalization
Realization
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.
Instance Diagrams
It means the object diagram is closer to the actual system behavior. The
purpose is to capture the static view of a system at a particular moment.
Answer
Class Diagrams
Object Diagrams
• Object diagrams are derived from class diagrams so object diagrams are
dependent upon class diagrams.
• Object diagrams represent an instance of a class diagram. The basic
concepts are similar for class diagrams and object diagrams. Object
diagrams also represent the static view of a system but this static view is
a snapshot of the system at a particular moment.
• Object diagrams are used to render a set of objects and their
relationships as an instance.
Object Diagrams use real world examples to depict the nature and structure of
the system at a particular point in time. Since we are able to use data available
within objects, Object diagrams provide a clearer view of the relationships that
exist between objects.
Figure – a class and its corresponding object
Answer