Unit Iv
Unit Iv
modelling
Object Modelling using UML
• In UML models, objects are model elements that represent instances
of a class or of classes.
• One can add objects to your model to represent concrete and
prototypical instances.
• A concrete instance represents an actual person or thing in the real
world.
OO Concepts
• In the object-oriented design method, the system is viewed as a collection of
objects (i.e., entities).
• The state is distributed among the objects, and each object handles its state
data.
• For example, in a Library Automation Software, each library representative may
be a separate object with its data and functions to operate on these data.
• The tasks defined for one purpose cannot refer or change data of other objects.
• Objects have their internal data which represent their state. Similar objects
create a class.
• In other words, each object is a member of some class.
• Classes may inherit features from the superclass.
• Objects: All entities involved in the solution design are known as objects. For example, person, banks,
company, and users are considered as objects. Every entity has some attributes associated with it and has
some methods to perform on the attributes.
• Classes: A class is a generalized description of an object. An object is an instance of a class. A class defines all
the attributes, which an object can have and methods, which represents the functionality of the object.
• Messages: Objects communicate by message passing. Messages consist of the integrity of the target object,
the name of the requested operation, and any other action needed to perform the function. Messages are
often implemented as procedure or function calls.
• Abstraction In object-oriented design, complexity is handled using abstraction. Abstraction is the removal of
the irrelevant and the amplification of the essentials.
• Encapsulation: Encapsulation is also called an information hiding concept. The data and operations are
linked to a single unit. Encapsulation not only bundles essential information of an object together but also
restricts access to the data and methods from the outside world.
• Inheritance: OOD allows similar classes to stack up in a hierarchical manner where the lower or sub-classes
can import, implement, and re-use allowed variables and functions from their immediate superclasses.This
property of OOD is called an inheritance. This makes it easier to define a specific class and to create
generalized classes from specific ones.
• Polymorphism: OOD languages provide a mechanism where methods performing similar tasks but vary in
arguments, can be assigned the same name. This is known as polymorphism, which allows a single interface
is performing functions for different types. Depending upon how the service is invoked, the respective
portion of the code gets executed.
What is UML
• Pins
• It is a small rectangle, which is attached to the action rectangle. It clears out all the messy
and complicated thing to manage the execution flow of activities. It is an object node that
precisely represents one input to or output from the action.
• Notation of an Activity diagram
• Activity diagram constitutes following notations:
• Initial State: It depicts the initial stage or beginning of the set of actions.
• Final State: It is the stage where all the control flows and object flows end.
• Decision Box: It makes sure that the control flow or object flow will follow
only one path.
• Action Box: It represents the set of actions that are to be performed.
• Why use Activity Diagram?
• An event is created as an activity diagram encompassing a group of nodes associated with edges. To model the behavior
of activities, they can be attached to any modeling element. It can model use cases, classes, interfaces, components,
and collaborations.
• It mainly models processes and workflows. It envisions the dynamic behavior of the system as well as constructs a
runnable system that incorporates forward and reverse engineering. It does not include the message part, which means
message flow is not represented in an activity diagram.
• It is the same as that of a flowchart but not exactly a flowchart itself. It is used to depict the flow between several
activities.
• How to draw an Activity Diagram?
• An activity diagram is a flowchart of activities, as it represents the workflow among various activities. They are identical
to the flowcharts, but they themself are not exactly the flowchart. In other words, it can be said that an activity diagram
is an enhancement of the flowchart, which encompasses several unique skills.
• Since it incorporates swimlanes, branching, parallel flows, join nodes, control nodes, and forks, it supports exception
handling. A system must be explored as a whole before drawing an activity diagram to provide a clearer view of the
user. All of the activities are explored after they are properly analyzed for finding out the constraints applied to the
activities. Each and every activity, condition, and association must be recognized.
• After gathering all the essential information, an abstract or a prototype is built, which is then transformed into the
actual diagram.
• Following are the rules that are to be followed for drawing an activity diagram:
• A meaningful name should be given to each and every activity.
• Identify all of the constraints.
• Acknowledge the activity associations.
• Example of an Activity Diagram
• An example of an activity diagram showing the business flow activity of order
processing is given below.
• Here the input parameter is the Requested order, and once the order is
accepted, all of the required information is then filled, payment is also
accepted, and then the order is shipped. It permits order shipment before an
invoice is sent or payment is completed.
• When to use an Activity Diagram?
• An activity diagram can be used to portray business processes and workflows.
Also, it used for modeling business as well as the software. An activity
diagram is utilized for the followings:
• To graphically model the workflow in an easier and understandable way.
• To model the execution flow among several activities.
• To model comprehensive information of a function or an algorithm employed
within the system.
• To model the business process and its workflow.
• To envision the dynamic aspect of a system.
• To generate the top-level flowcharts for representing the workflow of an
application.
• To represent a high-level view of a distributed or an object-oriented system.