Object Oriented Analysis and Design: Dr. Babasaheb Ambedkar Open University Ahmedabad
Object Oriented Analysis and Design: Dr. Babasaheb Ambedkar Open University Ahmedabad
PGDCA -204
BLOCK 1:
OBJECT ORIENTED
MODELLING
Author
PROF. K J Sharma
Language Editor
Mr. Vipul Shelke
Acknowledgment
Every attempt has been made to trace the copyright holders of material reproduced
in this book. Should an infringement have occurred, we apologize for the same and
will be pleased to make necessary correction/amendment in future edition of this
book.
The content is developed by taking reference of online and print publications that
are mentioned in Bibliography. The content developed represents the breadth of
research excellence in this multidisciplinary academic field. Some of the
information, illustrations and examples are taken "as is" and as available in the
references mentioned in Bibliography for academic purpose and better
understanding by learner.'
ROLE OF SELF INSTRUCTIONAL MATERIAL IN DISTANCE LEARNING
UNIT 1
INTRODUCTION TO OBJECT ORIENTED MODELLING 03
UNIT 2
ADVANCE MODELING CONCEPTS 17
BLOCK 1: OBJECT ORIENTED
MODELING
Block Introduction
Programming languages make it easier to design and implement
programming ideas, by ensuring that you don't have to learn binary, which is the
series of on/off or 1/0 commands the computer uses to calculate everything. The
JVM is an abstract instead of actual machine or processor. It specifies certain
instructions set, register sets, stack, garbage heap as well as required method. The
Java program is a set of instructions which a computer understand.
In this block, we will detail about object oriented modelling features as new
thinking technology for problem solving with knowledge on visualization in real
world. The block will focus on the study and concept of generalization and
inheritance abstractions in terms of structure and behaviour sharing of classes and
relationship. You will give an idea on metadata with respect to data or data
describing other data.
In this block, you will make to learn and understand about the basic of
Inheritance process in terms of object properties and usability in information. The
concept related to generalization with its shared characteristics in terms of classes
and super class. The shared characteristics with respect to attributes, associations
or methods are well detailed to you.
Block Objective
After learning this block, you will be able to understand:
1
Object Block Structure
Oriented
Unit 1: Introduction to Object Oriented Modelling
Modeling
Unit 2: Advance Modelling Concepts
2
UNIT 1: INTRODUCTION TO OBJECT
ORIENTED MODELLING
Unit Structure
1.0 Learning Objectives
1.1 Introduction
1.11 Glossary
1.12 Assignment
1.13 Activities
1.14 Case Study
1.15 Further Readings
3
Object 1.1 Introduction
Oriented
Modeling Object-oriented technology is incredibly wide and extensive. The users of
computer systems found the effects of such technology as increasingly easy-to-use
software applications and operating systems that are flexible that's catered by
many industries like banking, telecommunications and television. Just in case of
software technology, such object-oriented technology can cover object-oriented
management of projects, computer hardware and computer aided software
engineering, among others.
b. Use of objects
c. Use of classes
d. Both B and C
Objects
Objects are physical as they are present in universe around us. It is found
that hardware; software, documents and concepts are all object samples. For use
of modelling, an officer views staff, buildings, divisions, documents and benefits
packages as related objects. An automobile person would see tires, doors, engines,
speed and fuel level in terms of objects, while atoms, molecules, volumes, and
temperatures are objects according to chemist which can be thought of as making
an object oriented simulation of chemical reaction.
Normally it is viewed that objects can be considered as particular state. The
state of an object is basically the condition of an object, or set of circumstances
describing the item. It is generally seen that that people are talking about state
information which in particular relates to specific object. It is noticed that state of
bank account object will cover latest and available balance, which shows state of
clock object that is available at required time showing state of lightweight bulb
which could be placed at on or off state. For complex objects like a human being
or an automobile, an entire description of the state may be very complex.
Fortunately, when we use objects to model real world or imagined things, we have
6
a tendency to generally restrict the possible states of the objects to only people Introduction to
who are relevant to our models. Object Oriented
Modelling
c. Group of information
d. None of these
7
Object 4. Quaternary Association (degree of four)
Oriented 5. Higher order association (more than four)
Modeling
8
Introduction to
Object Oriented
Modelling
Inheritance is taken within the sense of code reuse within the object oriented
development. Throughout modelling, we look at the resulting classes, and try to
group similar classes along so code utilize can be enforced. Generalization,
specialization, and inheritance have terribly close association. Generalization is
used to refer to the relationship among classes, and inheritance is employed for
sharing attributes and operations using the generalization relationship.
Inheritance and generalisation have in common that they both have the
ability to define an abstract "contract" or "protocol" that a group of concrete
classes following this "contract" have to implement. this gives you the ability to
handle a number of comparable classes in an exceedingly uniform way, that
permits you to write down additional compact, abstract code, that once more
permits code reuse. Consider a class implements interface example where one
interface extends another interface as:
interface Printable{
void print();
}
9
Object }
Oriented class Testinterface2 implements Showable
Modeling
{
obj.show();
}
}
If we run this program we get an output as:
Sanjay
Mathur
d. All of these
10
Introduction to
Object Oriented
Modelling
An object also contains bodies of code that operate on the the object.
Objects that contain the same types of values and the same methods are
grouped into classes.
The only way in which one object can access the data of another object is by
invoking the method of that other object.
11
Object Check your progress 5
Oriented
Modeling 1. What is meant by sending message to object?
a. Passing parameters to object
d. None of these
High Code Reusability: once a new object is created, it'll automatically inherit
the data attributes and characteristics of the class from that it absolutely were
spawned. The new object will inherit the data and behaviours from all super
classes in which it participates. Once a user creates a new type of a widget, the
new object behaves "wigitty", while having new behaviours that are defined to the
system.
12
Check your progress 6 Introduction to
Object Oriented
1. What are the benefits of object oriented modeling? Modelling
a. Improved reliability
b. Improved flexibility
c. Reduced maintenance
d. All of these
Class diagrams/templates.
Object diagrams.
Class diagrams are used to model key abstractions in the problem domain
and their relationships with each other. Object diagrams are used to model the
interactions between objects, whereas object state diagrams model the dynamic
behaviour within a single object. An object state diagram shows all the possible
states of an object and the allowed transition between the states.
13
Object Check your progress 7
Oriented
Modeling 1. What are the two main stages of object –oriented design?
a. System design
b. Object design
c. Both of these
d. None of these
Answers: (1 –d)
Answers: (1 –a)
14
Check your progress 3 Introduction to
Object Oriented
Answers: (1 –b) Modelling
Answers: (1 –d)
Answers: (1 –b)
Answers: (1 –d)
Answers: (1 –c)
1.11 Glossary
1. Package - It is a collection of types that gives access protection and name
space management in Java.
2. Interface - In programming, interface is a mixture of abstract methods
where class implements an interface.
1.12 Assignment
Explain the Object oriented modelling and its advantages.
1.13 Activities
Study OOAD tools.
15
Object 1.14 Case Study
Oriented
Modeling Study the difference between generalisation and specialisation and also
justify how they are useful in Object oriented modelling
16
UNIT 2: ADVANCE MODELING CONCEPTS
Unit Structure
2.0 Learning Objectives
2.1 Introduction
2.2 Aggregation
2.7 Metadata
2.8 Constraints
2.13 Assignment
2.14 Activities
17
Object 2.1 Introduction
Oriented
Modeling Inheritance are often defined as the process wherever one object acquires the
properties of another. With the use of inheritance the information is made
manageable in a hierarchical order. Once we talk about inheritance, the most
unremarkably used keyword would be extends and implements. These words
would determine whether one object IS-A style of another. By using these
keywords we will create one object acquires the properties of another object.
Inheritance may be a compile-time mechanism. A super-class will have any
number of subclasses. However a subclass will have just one super class. This is
because Java does not support multiple inheritances.
2.2 Aggregation
Aggregation is an extension of association mean aggregation is a strong
form of association within which an aggregate object is formed of components.
Components are a part of the aggregate. So aggregation is the “part-whole” or “a-
part-of” relationship.
b. a-part-of relationship
c. Has-a relationship
d. Both B and C
18
2.3 Abstract Class Advance
Modeling
In Java, a class is a group of objects having certain common properties. It is Concepts
a sort of template or blueprint from where objects are created. So a class in java
contains:
Data member
Method
Constructor
Block
Class <class_name>{
Data member;
method
}
Output: 0 null
Abstract Class
An abstract class defines an abstract concept that can‟t be instantiated. we
can‟t create object of abstract class, it will only be inherited. Abstract class
19
Object normally represents concept with general actions associated with it. Abstract class
Oriented can‟t be instantiated; it will solely be inherited while interfaces should be
Modeling implemented. Abstract class will have implemented methods which interfaces will
have only definitions of the methods without implementation.
a. Inherited
b. Implemented
c. Instantiated
d. None of these
20
Consider an example: Advance
Modeling
Concepts
21
Object Inheritance results as an effective method which will share code among
Oriented various classes having some traits in common by allowing classes to have
Modeling different parts. Fig 2.2 called as Vehicle class which carries two subclasses as Car
and Truck.
It is seen that Vehicle class belongs to superclass of Car and Truck that are
subclasses of Vehicle. Here, the Vehicle class contain those fields and methods
which are Vehicles needed whereas Car and Truck have fields and methods
particular to Cars and Trucks.
As seen, when a subclass extends a super class, then all protected and public
fields and methods of it gets inherited by subclass. In this, the fields and methods
are part of subclass, as if subclass declared itself.
Multiple Inheritance is a technique where one class extends more than one
base class.
22
class can inherit information from the two relevant classes. This is shown in the Advance
figure 2.4. Modeling
Concepts
a. class B + class A
b. class B inherits class A
c. class B extends A
d. class B extends class A
b. IS-A relationship
c. Defining super class from given set of related entities
d. All of these
24
Advance
Modeling
Concepts
b. All ancestor class features must apply to the subclass instances, this is
known as restriction
c. Inherited features
d. None of these
2.7 Metadata
Metadata is called as data about data or data that describes about other data.
It is everywhere certainly where many data is useless without metadata as it is also
data. Metadata summarizes basic information about data, which can make finding
25
Object and working with particular instances of data easier. In addition to document files,
Oriented metadata is used for images, videos, spreadsheets and web pages. The use of
Modeling metadata on web pages can be very important. Metadata for web pages contain
descriptions of the page‟s contents, as well as keywords linked to the content.
These are usually expressed in the form of metatags. The metadata containing the
web page‟s description and summary is often displayed in search results by search
engines, making its accuracy and details very important since it can determine
whether a user decides to visit the site or not.
d. All of these
2.8 Constraints
A constraint could be a numeric or geometric relationship between objects.
Constraints have a declarative nature. Constraints are a natural manner for
describing relationships between objects. Combining constraint systems and
object-oriented programming (OOP) seems hard. All existing systems implicitly
compromise the encapsulation principle of OOP.
Constraints are a way to specific general properties for the system, without
specifying however they're being realized.
26
Advance
Check your progress 7
Modeling
1. What can constitute constraints? Concepts
a. Numeric data
b. Geometric relationship
c. Both of these
d. None of these
27
Object Check your progress 8
Oriented
Modeling 1. Why do there is a need to use object model?
a. It helps in faster development of software
b. reusability
c. reduces development risk
d. All of these
Answers: (1 –d)
Answers: (1 –a)
Answers: (1 –c)
28
Check your progress 4 Advance
Modeling
Concepts
Answers: (1 –d)
Answers: (1 –b)
Answers: (1 –d)
Answers: (1 –c)
Answers: (1 –d)
2.12 Glossary
1. Static variable - It is a variable which is declared as static is called static
variable
2. Class - These are group of objects with common properties and are like a
blueprint from where objects are created.
2.13 Assignment
Write a short note on inheritance and its use.
2.14 Activities
Study abstract classes and its usage
30
Block Summary
In this block, you will be detailed with knowledge about Inheritance and its
relationship with subclass and interface block. The concepts about types of
variables with illustrations are explained in step by step manner. The block stress
on information related to packages and interface with examples about inherit
abstract methods of interface. The information related to declaring a reference
variable of interface is well explained with examples.
After studying this block, you will feel self confident while working on
simple Java platform and can enhance their knowledge by studying certain
examples and illustrations mentioned in this block. With such detailed knowledge
on Inheritance, Interface, Packages and Exceptions in Java, you can be benefitted
in future.
31
Object Block Assignment
Oriented
Modeling Short Answer Questions
1. What is object oriented modeling?
2. Explain inheritance and its types
32
Enrolment No.
1. How many hours did you need for studying the units?
Unit No 1 2 3 4
Nos of Hrs
2. Please give your reactions to the following items based on your reading of the
block:
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
………………………………………………………………………………………………
33
Education is something
which ought to be
brought within
the reach of every one.
- Dr. B. R. Ambedkar