This document discusses classes and objects in object-oriented analysis and design. It defines objects as having state, behavior, and identity, with similar objects defined by common classes. Classes represent groups of objects with similar behavior and structures. The relationships between classes and objects are explored, including generalization, aggregation, and association. Identification of classes and objects in analysis is discussed through various approaches like use case analysis and CRC cards. The importance of proper classification and key abstractions and mechanisms are also covered.
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Classes and Objects
1. @2020 Presented By Y. N. D.
Aravind 1
Presented By
Y. N. D. ARAVIND
M.Tech, Dept of CSE
Newton’s Group Of Institutions, Macherla
2. @2020 Presented By Y. N. D. Aravind
Chapter 3 Classes and Objects 3
2.1 The Natue of Objects 4
2.2 Relationships among Object 7
2.3 The Natue of Classes 10
2.4 Relationships among Classes 11
2.5 Interplay of Classes and Objects 14
2.6 Identifying Classes and Objects 15
2.7 Importance of Proper Classification 18
2.8 Key abstractions and Mechanism 19
2
3. When we use object-oriented methods to analyze or design a complex software
system, our basic building blocks are classes and objects.
An object is an abstraction of something in a problem domain, reflecting the
capabilities of a system to keep information about it, interact with it, or both
Objects have an internal state that is recorded in a set of attributes.
Objects have a behavior that is expressed in terms of operations. The
execution of operations changes the state of the object and/or stimulates the
execution of operations in other objects.
Objects (at least in the analysis phase) have an origin in a real world entity.
Classes represent groups of objects which have the same behavior and
information structures.
Every object is an instance of a single class
Class is a kind of type, an ADT (but with data), or an 'entity' (but with
methods)
Classes are the same in both analysis and design
A class defines the possible behaviors and the information structure of all its
object instances.
@2020 Presented By Y. N. D. Aravind 3
CLASSES AND OBJECTS
4. An object is any of the following:
1. Tangible , and /or visible thing.
2. Object represents an individual , identifiable item, entity either real world or
abstract with a well defined role in the problem domain.
3. Object has state , behavior and identity , the structure and behavior similar
objects are defined on their common class , the terms instance and object are
interchangeable..
State :- The state of an object encompasses all of the properties of the object
plus the dynamic values of each of these properties.
A property is a distinctive characteristics that contributes to making an object
uniquely that object properties are usually static because attributes such as these
are unchanging and fundamental to the nature of an object.
Behavior :- How an object acts and reacts , in terms of its state changeable state
of object affect its behavior.
@2020 Presented By Y. N. D. Aravind
4
4
The Nature of Object’s
Static + Dynamic
5. Operations :- Denotes a service that a class offers to its clients. These are 5
kinds off operations.
1) Modifier – Alters state of an object.
2) Selector – Access state of an object.
3) Iterator – Permits access to all parts of object in defined order.
4) Constructor – Creates object and initialize its state.
5) Destructor – Frees or destroys state of object itself.
Identity :- Property of an object which distinguishes it from all other objects.
Object Life Span :- The Life line of an object extends from the time it is first
created until that space is recalled.
Roles and Responsibilities
Role :- Role is a mask that an object wears and defines a contract between an
abstraction and its clients.
Responsibilities :- Purpose of object and its place in system.
@2020 Presented By Y. N. D. Aravind
5
5
The Nature of Object’s
6. Object as Machine :- The existence of state within an object means that the
order in which operations are invoked into two types „Active‟ and „Passive‟.
@2020 Presented By Y. N. D. Aravind
6
6
The Nature of Object’s
7. Two kinds of objects relationships
1) Links
2) Aggregation
1) Links :- Specific Association through which one object applies services of another
object.
As a participation in a link , an object may play one of three roles.
a. Controller – Operates another object.
b. Server – Operated by another object.
c. Proxy – Both operates and operated by objects.
Visibility:- It consists of four ways
a. Globally declared
b. Locally declared
c. Part of a client object
d. Programming object
Synchronization:- One object passes message to another object across a link. It consists of
three approaches.
a. Sequential
b. Guarded
c. Concurrency
@2020 Presented By Y. N. D. Aravind
7
7
Relationship among Object’s
8. 2) Aggregation :- Aggregation is a special kind of Association . It may or may
not denote physical containment whole / part of hierarchy.
@2020 Presented By Y. N. D. Aravind
8
8
Relationship among Object’s
9. Class is a set of object that share a common behavior and common semantics.
Interface and Implementation:-
Interface :- Interface is a outside view of abstraction.
Implementation :- Implementation is a inside view of abstraction.
The interface of the class is divided into following 4 parts
i. Public :- A declaration that is accessible to all clients.
ii. Protected :- A declaration that is accessible only to the class itself and its
subclass.
iii. Private :- A declaration that is accessible only to class itself.
iv. Package :- a declaration that is accessible only by classes in the same
package.
@2020 Presented By Y. N. D. Aravind
9
9
The Nature of Classes
10. There are THREE basic kinds of class relationships.
1) Association : which denotes semantics dependency among unrelated classes. The
symbol for association is
2) Generalization / specification ,denotes „is – a‟ relationship .
The symbol for generalization is
3) Aggregation / whole / part of relationship.
The symbol for aggregation is
Association :- The identification of association among classes is
describing how many classes / objects are taking part in relationship.
Multiplicity/Cardinality :- The multiplicity denotes the cardinality of
the association. There are three common kinds of multiplicity across an
association.
a. One – to – One
b. One – to – Many
c. Many – to - Many
@2020 Presented By Y. N. D. Aravind
10
10
Relationship among Classes
11. Inheritance:- Inheritance exists to express a generalization/specification
relationships. It is a relationship among classes where in one class shares
the structure and /or behavior defined in one or more other classes.
Inheritance means that subclass inherit the structure of their superclass.
Single Inheritance :- The single inheritance relationships deriving from
the super class. Each directed line denotes an „is - a‟ relationship.
Multiple Inheritance :- The multiple inheritance illustrates a class
structure.
Polymorphism :- It is a concept in type theory where in a name may
denote instances of many different classes as long as they are related by
common superclass. It is an operation can be implemented differently by
the classes in the hierarchy.
@2020 Presented By Y. N. D. Aravind 11
Relationship among Classes
12. Aggregation :- Aggregation relationship which provides the whole/put relationship
manifested in the class instances.
Aggregation relationships among classes have a direct parallel to aggregation
relationships among the objects corresponding to these classes.
1) Physical containment :- The life time of two objects are intimately connected.
2) Using :- „Using‟ shows a relationship between classes in which one class uses certain
services of another class in a variety of ways. „Using‟ relationship is equivalent to an
association.
3) Installation :- The process of creating a new object is referred to as instantiation
4) Genericity :- The possibility for a language to provided parameterized modules or
types. These are four basic ways of genericity.
a. Use of macros
b. Building heterogeneous class.
c. Using parameterized class must be instantiated before objects can be created .
d. By building generalized container classes which are strongly supported inheritance
but don‟t support any form of parameterized class.
5) Meta class :- Meta class is a class whose instances are themselves classes. It is used to
provide class variables and operations for initializing class variables and for creating the
meta classes single instance.
@2020 Presented By Y. N. D. Aravind 12
Relationship among Classes
14. Classes and objects are separate yet intimately related concepts .Specially, every
object is the instance of some class, and every class has zero or more instances.
• Class of most objects is static.
• Objects are typically created and destroyed at a rapid rate during lifetime
of an application.
Example :- Air Traffic Control system Planes, flight plans , runways and
airspaces
@2020 Presented By Y. N. D. Aravind 14
Interplay of Classes and Objects
15. Classical and modern approaches. There are three general approaches to
classification:
1) Classical Categorization:-
All the entities that have a given property or collection of properties in common
forms a category .
In certain criteria sameness among objects specifically one can divide objects
into disjoint sets depending upon the presence or absence of a particular property.
2) Conceptual Clustering:-
In this approach classes are generated by first formulating . Conceptual
description of classes and then classifying the entities according to the
descriptions.
3) Prototype Theory:-
In prototype theory, group things according to the degree of their relationship to
conduct prototypes.
@2020 Presented By Y. N. D. Aravind 15
Identifying Classes and Objects
16. Object Oriented Analysis :-
In Analysis, we try to discover the classes and objects that comprise the
vocabulary of the problem domain. A number of approaches have been used in
carrying out this task.
Classical Approaches:-
It is one of approach for analysis which derive primarily from the principles of
classical categorization.
tangible things, roles, events , and interactions
• From the perspective of data base modeling
people, places, things, organization, concepts, and events
• Another set of sources of potential objects
structure, events remembered, roles played, locations, organizational units
@2020 Presented By Y. N. D. Aravind 16
Identifying Classes and Objects
17. Behavioral Analysis :- Classes based on groups of objects that exhibit similar
behavior.
Domain Analysis :- It is to identify the classes and objects that are domain to
all applications within a given domain.
Use case Analysis:- It is used to identify the objects that participate in the
scenario , responsibilities of each object and objects collaborate with other
objects in terms of operations.
CRC Cards (Class –Responsibilities/Collaborations):-
It is a tool that facilities training and enhance communication among developer
upon which analysis with the name of class , its responsibilities and its
collaborators one card is created for each class identified as relevant to the
scenario. CRC cards are arranged to represent generalization / specification or
aggregation hierarchies among the classes.
Structured Analysis :- Structured analysis is a technique that has been used to
develop programs using concepts of structured programming,
which, as we have previously noted has a procedural basis.
@2020 Presented By Y. N. D. Aravind 17
Identifying Classes and Objects
19. 1) Finding key abstraction – Primary values
2) Refining key abstraction
Promotion
grainsize conflict
Naming conventions are as follows :-
Object :- Proper Noun.
Class :- Common Noun.
Modifier :- Active Work.
Sector :- Work in the form of “to be”.
Identifying Mechanism
Mechanism:- It is a process of designing patterns of a behavior
1) Mechanical Linkage
2) Electronic Linkage
3) No Linkage
@2020 Presented By Y. N. D. Aravind 19
Key Abstraction and Mechanism
20. Thank You
@2020 Presented By Y. N. D. Aravind
Presented By
Y. N. D. ARAVIND
M.Tech, Dept of CSE
Newton’s Group Of Institutions, Macherla
20