Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Difference between Aggregation and Association:

Aggregation Association

Aggregation describes a special type of an Association is a relationship between


association which specifies a whole and part two classes where one class use
relationship. another.

It in flexibile in nature It is inflexible in nature

Special kind of association where there is It means there is almost always a link
whole-part relation between two objects between objects

It is represented by a “has a”+ “whole-part” It is represented by a “has a”


relationship relationship

Diamond shape structure is used next to the Line segment is used between the
assembly class. components or the class

How to draw an object diagram?


1. Before drawing an object diagram, one should analyze all the objects
inside the system.
2. The relations of the object must be known before creating the diagram.
3. Association between various objects must be cleared before.
4. An object should have a meaningful name that describes its
functionality.
5. An object must be explored to analyze various functionalities of it.

Use-case diagram notations


Following are the common notations used in a use case diagram:

Use-case:

Use cases are used to represent high-level functionalities and how the user
will handle the system. A use case represents a distinct functionality of a
system, a component, a package, or a class. It is denoted by an oval shape
with the name of a use case written inside the oval shape. The notation of a
use case in UML is given below:

UML UseCase Notation

Actor:

It is used inside use case diagrams. The actor is an entity that interacts with
the system. A user is the best example of an actor. An actor is an entity that
initiates the use case from outside the scope of a use case. It can be any
element that can trigger an interaction with the use case. One actor can be
associated with multiple use cases in the system. The actor notation in UML is
given below.

UML Actor Notation

Benefits of a Sequence Diagram


 Sequence diagrams are used to explore any real application or a
system.
 Sequence diagrams are used to represent message flow from one
object to another object.
 Sequence diagrams are easier to maintain.
 Sequence diagrams are easier to generate.
 Sequence diagrams can be easily updated according to the changes
within a system.
 Sequence diagram allows reverse as well as forward engineering.

Define these Two Components of Activity Diagram

i. Fork

ii. Join nodes

Fork and Join nodes


Using a fork and join nodes, concurrent flows within an activity can be
generated. A fork node has one incoming edge and numerous outgoing
edges. It is similar to one too many decision parameters. When data arrives at
an incoming edge, it is duplicated and split across numerous outgoing edges
simultaneously. A single incoming flow is divided into multiple parallel flows.

A join node is opposite of a fork node as It has many incoming edges and a
single outgoing edge. It performs logical AND operation on all the incoming
edges. This helps you to synchronize the input flow across a single output
edge.

Applications of Object Diagrams:


1. Object diagrams play an essential role while generating a blueprint of an
object-oriented system.
2. Object diagrams provide means of modeling the classes, data and other
information as a set or a single unit.
3. It is used for analyzing the online or offline system. The functioning of a
system can be visualized using object diagrams.

Polymorphism
If one task is performed in different ways, it is known as polymorphism. For example: to
convince the customer differently, to draw something, for example, shape, triangle,
rectangle, etc.

In Java, we use method overloading and method overriding to achieve polymorphism.

Another example can be to speak something; for example, a cat speaks meow, dog barks
woof, etc.

Encapsulation
Binding (or wrapping) code and data together into a single unit are known as encapsulation.
For example, a capsule, it is wrapped with different medicines.

A java class is the example of encapsulation. Java bean is the fully encapsulated class
because all the data members are private here.

When Use Activity Diagram


Activity diagram is used to model business processes and workflows. These diagrams
are used in software modeling as well as business modeling.

Most commonly activity diagrams are used to,

1. Model the workflow in a graphical way, which is easily understandable.


2. Model the execution flow between various entities of a system.
3. Model the detailed information about any function or an algorithm which is
used inside the system.
4. Model business processes and their workflows.
5. Capture the dynamic behavior of a system.

Terminologies of State Transition Diagram

State
In the state transition diagram, An object always remains in some state. Further, the state of the
object may change after an event occur.

Event

Any activity that may trigger a state transition or can change the state.

Guard

In the state transition diagram, a guard is a boolean expression. Suppose if the guard is true, then
it enables an event to trigger a transition.

Transition

The change of state within an object is represented with a transition. It is possible that an object
changes its state when the transition occurs.

Action

One or more actions are taken by an object when the object changes a state.

Class vs. Object Diagrams


Serial Class Object
no.

1 It represents static aspects of a system. It represents the behavior of


a system in real time.

2 It doesn't include dynamic changes. It captures runtime changes


of a system.

3 It never includes attributes or data values of It includes attributes and data


an instance. values of any instance.

4 Class diagram manipulates the behavior of Objects are instances of


objects. classes

Purpose of Use Case Diagram


Use case diagrams are typically developed in the early stage of development and people often
apply use case modeling for the following purposes:

 Specify the context of a system

 Capture the requirements of a system

 Validate a systems architecture

 Drive implementation and generate test cases

 Developed by analysts together with domain experts


What is the State transition Diagram?
When we write our program in Object-oriented programming, then we need to
take classes and objects. Objects change their states during different functions/actions
performed on objects.
In a state transition diagram, the states appear as rounded rectangles with the state
names inside.

Symbols used in State Transition Diagram

When I can Use State Transition Diagram?

1. When the system has some dependencies on the events or on the values in the past.
2. State Transition diagram can be used when a software tester is testing the system for a finite set
of input values.
3. When the software tester focus is to understand the behavior of the object.
4. When the software tester focus is to test the sequence of events that may occur in the system
under test.

Examples of State Transition Diagram


Case Study:
Draw the state transition diagram that You need to develop a web-based application
in such a way that users can search other users, and after getting search complete, the
user can send the friend request to other users. If the request is accepted, then both
users are added to the friend list of each other. If one user does not accept the friend
request. The second user can send another friend request. The user can also block
each other.
Solution:

1. First of all, identify the object that you will create during the development of classes in oop
2. Identify the actions or events
3. Identify the possible states for an object
4. Draw the diagram.

Object: friends
Events or actions: Search to add a friend, add a friend, accept a friend, reject a friend,
again add, block user and close.
States: Start, the friend added, friend rejected, user blocked and end.

How to Make a State Transition (Examples of a


State Transition)
Example 1:
Draw the state transition diagram, Let's consider an ATM system function
where if the user enters the invalid password three times the account will be
blocked.
In this system, if the user enters a valid password in any of the first three
attempts the user will be logged in successfully. If the user enters the invalid
password in the first or second try, the user will be asked to re-enter the
password. And finally, if the user enters incorrect password 3rd time, the
account will be blocked.

State transition diagram

In the diagram whenever the user enters the correct PIN he is moved to
Access granted state, and if he enters the wrong password he is moved to
next try and if he does the same for the 3rd time the account blocked state is
reached.

State Transition Table


Correct PIN Incorrect PIN

S1) Start S5 S2

S2) 1st attempt S5 S3

S3) 2nd attempt S5 S4


S4) 3rd attempt S5 S6

S5) Access Granted - -

S6) Account blocked - -

In the table when the user enters the correct PIN, state is transitioned to S5
which is Access granted. And if the user enters a wrong password he is
moved to next state. If he does the same 3rd time, he will reach the account
blocked state.

Explain the different elements of a Use Case.

What is the Use Case Diagram?

Explain the different elements of a Use Case.

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.

Use case diagram is a subset of various behaviour diagrams. Use case diagrams are used to
provide concrete examples of the elements which are supposed to implement. It is used to
analyze objects.

The following are the elements of the use case diagrams:

Actors: An actor is one of the entities who perform certain actions. These roles are the actual
business roles of the users in given system. An actor interacts with a use case of the system. For
example, for a banking system, a customer is one of the actors.
Use Case: A use case is a use case diagram of UML represents a business functionality that is
distinct. The use case should list the discrete business functionality that is specified in the
problem statement. Every business functionality is a potential use case.

System boundary: A system boundary defines the scope of the system. The systems that use
cases also need to be defined in the limits of the system. The system boundary is shown as a
rectangle that spans all use cases of the system.

What is class diagram? explain with example, also describe the


purpose of Class Diagrams?

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.

Class diagram describes the attributes and operations of a class and also the constraints imposed
on the system..

Class diagram shows a collection of classes, interfaces, associations, collaborations, and


constraints. It is also known as a structural diagram.

The following diagram is an example of an Order System of an application. It describes a


particular aspect of the entire application.

 First of all, Order and Customer are identified as the two elements of the system. They
have a one-to-many relationship because a customer can have multiple orders.

 Order class is an abstract class and it has two concrete classes (inheritance relationship)
SpecialOrder and NormalOrder.

 The two inherited classes have all the properties as the Order class. In addition, they have
additional functions like dispatch () and receive ().
The following class diagram has been drawn considering all the points mentioned above.

Purpose of Class Diagrams

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 object-oriented languages and thus widely used
at the time of construction.
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.

You might also like