Activity, Class
Activity, Class
It is the general purpose modeling language used to visualize the system. It is a graphical
language that is standard to the software industry for specifying, visualizing, constructing and
documenting the artifacts of the software systems, as well as for business modeling.
Benefits of UML:
Simplifies complex software design, can also implement OOPs like concept which
is widely used.
It reduces thousands of words of explanation in a few graphical diagrams that may
reduce time consumption to understand.
It makes communication more clear and real.
It helps to acquire the entire system in a view.
It becomes very much easy for the software programmer to implement the actual
demand once they have the clear picture of the problem.
1. We use Activity Diagrams to illustrate the flow of control in a system and refer to
the steps involved in the execution of a use case. Primary use is to depict the
dynamic aspects of a system.
2. Used to represent dynamic aspect of the system, basic nature of activity diagram
is scenario specific which represents a set of activities performed in a particular
scenario.
3. We can draw an activity diagram for a particular scenario or use case but cannot
draw it for entire system.
4. It may have more than one final nodes based on different exit condition but it
must have only one initial condition.
5. An activity diagram is very similar to a flowchart. So let us understand if an
activity diagrams or a flowcharts are any different :
Difference between an Activity diagram and a Flowchart –
Flowcharts were typically invented earlier than activity diagrams. Non-programmers use
Flow charts to model workflows. For example: A manufacturer uses a flow chart to
explain and illustrate how a particular product is manufactured. We can call a flowchart
a primitive version of an activity diagram. Business processes where decision making is
involved is expressed using a flow chart.
So, programmers use activity diagrams (advanced version of a flowchart) to depict
workflows. An activity diagram is used by developers to understand the flow of
programs on a high level. It also enables them to figure out constraints and conditions
that cause particular events. A flow chart converges into being an activity diagram if
complex decisions are being made.
What is Class?
A Class is a blueprint that is used to create Object. The Class defines what
object can do.
Class Diagram defines the types of objects in the system and the different
types of relationships that exist among them. It gives a high-level view of an
application. This modeling method can run with almost all Object-Oriented
Methods. A class can refer to another class. A class can have its objects or
may inherit from other classes.
Class Diagram helps construct the code for the software application
development.
1. Class Name
2. Attributes
3. Operations
Class Name
The name of the class is only needed in the graphical representation of the
class. It appears in the topmost compartment. A class is the blueprint of an
object which can share the same relationships, attributes, operations, &
semantics. The class is rendered as a rectangle, including its name,
attributes, and operations in sperate compartments.
Attributes:
An attribute is named property of a class which describes the object being
modeled. In the class diagram, this component is placed just below the name-
compartment.
A derived attribute is computed from other attributes. For example, an age of
the student can be easily computed from his/her birth date.
Attributes characteristics
The attributes are generally written along with the visibility factor.
Public, private, protected and package are the four visibilities which are
denoted by +, -, #, or ~ signs respectively.
Visibility describes the accessibility of an attribute of a class.
Attributes must have a meaningful name that describes the use of it in a
class.
Relationships
There are mainly three kinds of relationships in UML:
1. Dependencies
2. Generalizations
3. Associations
Dependency
Generalization:
Association:
This kind of relationship represents static relationships between classes A and
B. For example; an employee works for an organization.
In this example, the relationship between student and college is shown which
is studies.
Multiplicity
Aggregation
Composition:
This abstract class method can be used by any object such as a car, an
animal, robot, etc. for changing the current position. It is efficient to use this
abstract class method with an object because no implementation is provided
for the given function. We can use it in any way for multiple objects.
In UML, the abstract class has the same notation as that of the class. The
only difference between a class and an abstract class is that the class name is
strictly written in an italic font.
In the above abstract class notation, there is the only a single abstract method
which can be used by multiple objects of classes.
Example of UML Class Diagram
Creating a class diagram is a straightforward process. It does not involve
many technicalities. Here, is an example:
Lifeline Notation
A sequence diagram is
made up of several of these lifeline notations that should be arranged
horizontally across the top of the diagram. No two lifeline notations should
overlap each other. They represent the different objects or parts that interact
with each other in the system during the sequence.
A lifeline notation with an actor element symbol is used when the particular
sequence diagram is owned by a use case.
Activation Bars
Activation bar is the box placed on the lifeline. It is used to indicate that an
object is active (or instantiated) during an interaction between two objects.
The length of the rectangle indicates the duration of the objects staying active.
Synchronous message
An asynchronous message is used when the message caller does not wait for
the receiver to process the message and return before sending other
messages to other objects within the system. The arrowhead used to show
this type of message is a line arrow like shown in the example below.
Return message
Objects do not necessarily live for the entire duration of the sequence of
events. Objects or participants can be created according to the message that
is being sent.
The dropped participant box notation can be used when you need to show
that the particular participant did not exist until the create call was sent. If the
created participant does something immediately after its creation, you should
add an activation box right below the participant box.
Participant destruction message
Reflexive message