Bca-622 Uml
Bca-622 Uml
s out like start a car, operations or functions or methods wrapped in the class can access it. This gives
stop a car, change gear, accelerate, and apply brake. The behavior is described by protection and security to the data. The data is insulated from direct access. This
Review of Object Orientation the operations or the methods. achieves a way to hide information or data.
All the cars have a brand name, a model name, a color and so on. All the cars
can be started, stopped, accelerated. All the features that describe the state and the
2.0 Objectives behavior of cars are similar. So we need not define them separately.
2.1 Introduction
brandName = Tata
2.2 Object modelName = Nano
2.3 Class color = Yellow
…
2.4 Encapsulation
2.5 Abstraction
For the car class the following diagram shows the encapsulation where the
2.6 Inheritance A dog is an animal. A cat is an animal. A cow is an animal. A lion is an animal.
operations are around the attributes. The attributes are not directly visible or open to
2.7 Polymorphism brandName = the outside. The operations above them form an insulating cover or wrapper around The superclass is animal. The subclasses are dog, cat, cow, and lion.
2.7.1 Function Polymorphism Hyundai them.
2.7.2 Operator Polymorphism modelName = i10
color = Red
2.8 Message Passing …
2.9 Summary
2.10 Check your Progress – Answers
2.11 Questions for Self – Study
2.3 CLASS
2.12 Suggested Readings
There can be a large number of cars. We need not define each of them
separately. Instead we can describe them together by grouping all the cars under a
pattern, template or blueprint. This pattern is known as a class. It creates a group of
2.0 OBJECTIVES structurally identical items. e.g. car. A car can have attributes like a brand name, a
To revise the following object oriented concepts - model name, a color. A car can have operations like to stop, to start, to accelerate, to
change gear. A class consists of both a pattern and a mechanism for creating items 2.5 ABSTRACTION
▫ Objects
based on that pattern. The items created or manufactured using the class are called 2.4-2.6 Check your progress
▫ Classes instances. e.g. myCar, yourCar. Abstraction is the act of representing the essential features without including
the background details or explanations. This is a fundamental principle of modeling. True or False
▫ Encapsulation A system model is created at different levels, starting at the higher level and adding
▫ Abstraction more levels are more and more details become known about the system. A model 1. The data is directly accessible to the outside world due to encapsulation.
Attributes Operations can be viewed at several levels, each giving different details about the system. So
▫ Inheritance brandName stop() abstraction is looking only at the information that is relevant at the time by hiding 2. Abstraction is looking only at the information that is relevant at the time by
modelName start() details so that there is no confusion in understanding the system. hiding details.
▫ Polymorphism
color accelerate()
▫ Message passing numberOfGears changeGear() For example, 3. Encapsulation supports abstraction.
currentGear applyBrake()
A car is an abstraction which represents the features i.e. the attributes like
… … 4. Inheritance supports hierarchical classification and provides reusability.
brandName and modelName and the operations like start and change gear. Also a
car represents all possible models of all possible cars.
2.1 INTRODUCTION 2.6 INHERITANCE 2.7 POLYMORPHISM
The UML can be used in a better way with the object oriented technologies. 2.2-2.3 Check your progress
The process by which objects of one class acquire the properties of objects of Polymorphism means the ability to take more than one form. The
So there is a need to revise the object concepts. All the important concepts will be another class is known as inheritance. This supports hierarchical classification. This
Fill in the blanks polymorphism is of two types:
covered in this chapter. provides reusability. It makes it possible to add additional features to an existing
1. The ………………….. is the property of an object that distinguishes it from other class without modifying it. This helps avoid duplication. 2.7.1 Function polymorphism
2.2 OBJECT
object A class known as the subclass or the child class can inherit attributes and An operation may exhibit different behavior in different instances depending
Every day we come across many things. The things can be a tangible thing like
operations from another class known as the superclass or the parent class. The upon the data used in the operation. Here a single name is used to perform different
a car or a printer, a role like an employee or a boss, an incident like a flight or an 2. The behavior describes the ……………… the object carries out.
subclass provides the specialized behavior whereas the superclass provides the tasks. The same method used in a superclass can be overridden in subclasses to
overflow, interaction like contract or a sale or a specification like a color or a shape. 3. A class creates a group of ………………. items.
generalized behavior. give a different functionality.
Each of these things has some kind of identity, state and behavior. 4. The items created or manufactured using the class are called
For example,
The identity is the property of an object that distinguishes it from other objects …………………………
like myCar, yourCar. For example: All animals make some kind of a sound. But the sounds of different animals
are termed differently. A cat mews. A dog barks. A lion roars.
The state describes the data stored in that object like for a car we can specify 2.4 ENCAPSULATION A car is a vehicle. An auto rickshaw is a vehicle. A truck is a vehicle. The
the brand name as Tata, the model name as Nano, the color as yellow for myCar superclass is vehicle. The subclasses are car, auto rickshaw, truck. All polygons occupy area. A triangle, a rectangle, a square are all polygons. The
The wrapping of data and functions into a single unit called a class is known as
and the brand name Hyundai, the model name as i10, the color as red for yourCar superclass polygon has a method getArea(). For getArea() in subclass triangle the
encapsulation. The data is not directly accessible to the outside world. Only the
and so on. The state or the structure is described by the properties or the attributes.
Unified Modeling System / 8 Unified Modeling System / 10
Review of Object Orientation / 7 Review of Object Orientation / 9
calculation is done by the formula ½ of the product of the base and height. For 2.10 CHECK YOUR PROGRESS - ANSWERS Chapter 3
getArea() in subclass rectangle the calculation is done by the formula product of the
2.2-2.3
length and breadth. Overview of UML
1. Identity
2.7.2 Operator polymorphism
2. Operations
This is the process of making an operator to exhibit different behaviors in different
3.0 Objectives
instances. 3. Structurally identical Interface – interface defines a set of operations which specifies what a class can do.
3.1 Introduction
For example, 4. Instances Collaboration – collaboration defines an interaction between things to achieve some
3.2 Things goal.
‘+’ operator when used with integers, it gives the result as the addition of the two 2.4 - 2.6
3.2.1 Structural Things Use case – use case represents a set of actions performed by a system for a
integers. We might wish ‘+’ to add two matrices or two vectors.
1. False
3.2.2 Behavioral Things specific goal.
2.8 MESSAGE PASSING 2. True 3.2.3 Grouping Things
A message is a request for execution of a procedure that invokes a function in the
3. True 3.2.4 Annotational Things
receiving object that generates the desired result.
4. True 3.3 Relationships
Message passing achieves communication between a set of objects with each other. Component – component describes a physical part of the system.
This communication is established by sending and receiving information. This can 3.3.1 Dependency
be achieved by specifying the name of the object, the name of the function 2.7-2.8 3.3.2 Association
(message) and the information to be sent.
1. Polymorphism 3.3.3 Generalization
For example, Node – a node can be defined as a physical element that exists at runtime.
2. An operation 3.3.4 Realization
A television may be operated by a remote. When the ON button on the remote is 3.4 Diagrams
pressed; the television should get switched on. Similarly when the OFF button on the 3. different behaviors
remote is pressed; the television should get switched off. The volume 3.4.1 Structure Diagrams
4. message
increase/decrease button on the remote is pressed; similar action should be 3.4.2 Behaviour Diagrams
activated by the television. For this the object ‘remote’ invokes the function of the
3.4.3 Interaction Diagrams
object ‘television’.
2.11 QUESTIONS FOR SELF – STUDY 3.5 Summary 3.2.2 Behavioral things
3.6 Check your Progress – Answers These are also called the verbs of the UML models. These are usually the dynamic
1. What is an object? 3.7 Questions for Self – Study parts of the system. Following behavioral things are available with the UML for use.
2. What are classes? 3.8 Suggested Readings Interaction – some behavior constituted by messages exchanged among objects.
The exchange of messages is with a view to achieving some purpose.
3. What is abstraction?
4. What is inheritance?
3.0 OBJECTIVES
5. What is encapsulation?
To understand the building blocks of UML
6. What is the purpose of message passing? State machine – state machine is useful when the state of an object in its lifecycle is
2.7-2.8 Check your progress ▫ Things and its four types important. It defines the sequence of states an object goes through in response to
events. Events are external factors responsible for state change
Fill in the blanks ▫ Relationships and its four types
▫ Diagrams and its three types.
1. ………………… means the ability to take more than one form.
2.12 SUGGESTED READINGS
2. ………………. may exhibit different behavior in different instances
3.1 INTRODUCTION
depending upon the data used in the operation. This is function UML is constructed from three main building blocks: things, relationships and .
polymorphism. 1. Unified Modeling Language User Guide by Grady Booch,James Rumbaugh, diagrams. When these building blocks are understood correctly it is easy to use the 3.2.3 Grouping things
Ivar Jacobson UML.
3. Operator polymorphism is the process of making an operator to exhibit This is the organizational part of the UML. It provides a higher level of abstraction.
………………… in different instances. 2. UML 2 For Dummies by Michael Jesse Chonoles, James A. Schardt 3.2 THINGS Following grouping mechanism is available with the UML for use.
4. A ………………… is a request for execution of a procedure that invokes There are four types of things in the UML. These are structural, behavioral, grouping Package – a general purpose element that comprises UML elements – structural,
a function in the receiving object that generates the desired result. and annotational. behavioral and even grouping things. These are conceptual groupings of the system
and need not necessarily be implemented as cohesive software modules.
3.2.4 Annotational things diagram. This includes communication, interaction overview, sequence and timing
diagrams.
This is the explanatory part of the UML model. It adds information or meaning to the
model elements. Following annotational mechanism is available with the UML for
use. 3.4 Check your progress
For example,
Note – it is a graphical notation for attaching constraints, rules, comments to
An animal (generalization) and a cat (specialization) are related by the Fill in the blanks
elements of the model.
generalization-specialization relationship.
1. Structure diagrams is a set of diagrams that depicts the elements of a
3.3.4 Realization specification those are ……………….. of time.
Realization is a semantic relationship between two things where one specifies the
2. ………………….. is a set of diagrams that depicts behavioral features of a
behavior to be carried out and the other carries out the behavior. I.e. one element
system or business process.
3.2 Check your progress describes some responsibility which is not implemented and the other one
implements it. This relationship exists in case of interfaces. The notation used is a 3. ………………… is a set of diagrams which emphasize object interactions.
Fill in the blanks dashed line with a empty triangular block arrowhead.
NOTES NOTES