Title: ObjectOriented Concepts
1Object-Oriented Concepts
2Object-Oriented ConceptsOutlines
- The Six Basic OO Concepts
- Discovering Objects
- Discovering Attributes
- Discovering Methods
- Evaluating Candidate Objects
- Applicability of OO Concepts
3The Six Basic OO Concepts
- Object
- Class
- Instance
- Attribute
- Method
- Message
4Object
- An object represents an individual, identifiable
item, unit, or entity, either real or abstract,
with a well-defined role in the problem domain. - An object can be any person, place, thing,
event, screen, report, or concept that is
applicable to the design of the system.
5Class
- A class is a collection of similar objects.
- A class is a general definition of the attributes
and methods of a set of objects. - Examples Customer, Vehicle, Account Receivables.
6Instance
- When an application is running, objects are
instantiated from a class, and the objects become
instances of the class - - Joe Bair is an instance of the class of
Customer. - - Plymouth Voyager is an instance of the class
of Vehicle.
7In Terms of a Relation
- A class - a relation (table)
- An object - a record
- An attribute - a data item (field)
Description
Price
On Hand
Prod
A1201
Intel PP
325.99
72
A1202
Segate 1.6G
159.45
182
A1203
Dell MD-3
1499.00
64
A1204
Tech 1.44
45.99
28
A1205
MS 3-B
34.99
267
8Attribute
- Attributes are things that an object knows.
- Attributes are properties and characteristics of
an object. - An attribute is basically a data item of an
object. - Examples
- - Account Number is an attribute of the class
of Account. - - Student ID is an attribute of the class of
Student.
9Method
- Methods are things that a class or object does.
- Methods usually contain business logic employed
in the application. - A method is similar to a function, a procedure,
or a subroutine in terms of structured
programming. Examples - - Create a New Account is a method of the
class of Account. - - Register for a Class is a method of the
class of Student.
10Attributes vs. Methods
- Attributes define the data, while methods define
the functionality. - Attributes are defined by their names and types
(e.g., integer, string, date). - Methods are defined by writing the code for it.
- Attributes and methods are both shielded by the
corresponding objects.
11Message
- When attributes and methods are encapsulated
inside the objects, sending messages become the
mechanism to communicate interacting objects. - A message is composed of the name of the method
and any necessary parameters. A general message
format looks like this - Object.method(parameters).
- For example, formula.square_root(100) returns a
value of 10.
12Summary
- The OO paradigm is based on the concept that
systems should be built out of ______. - The objects should have both data and
functionality. ______ define data, while ______
define functionality. - Similar objects are grouped into a ____, and
objects can be created as _____of the class. - Objects interact through sending _____.
13Summary
- The OO paradigm is based on the concept that
systems should be built out of objects. - The objects should have both data and
functionality. Attributes define data, while
methods define functionality. - Similar objects are grouped into a class, and
objects can be created as instances of the class. - Objects interact through sending messages.
14Summary
Methods
Other Objects
message
Attributes
Owner Address Acct Balance Interest Rate
Tom Blake
deposit
16 Wood St.
122-467-3345
492.87
2.5
Account Object 9987554
15Discovering Objects
- There is a great deal of detail surrounding any
OO model - attributes, methods, messages, and so
on - but the heart of the OO model is the set of
classes and objects. - Discovering classes and objects is the starting
point for all OO system development.
16Discovering Objects
- Objects can be discovered from the
- following four different perspectives
- Data
- Function
- Relationship
- Behavior
17Discovering ObjectsThe Data Perspective
- For many business applications, data is usually
the dominant characteristic of the system. - Business entities are usually associated with
data. - Discovering objects from the data perspective is
very similar to discovering entities in
ERD-based data modeling methodologies.
18Discovering ObjectsThe Data Perspective
- Look at events that must be recorded and
processed by the system. - Look at roles played by different people who
interact with the system. - Look at physical locations and sites that may be
relevant to the system.
19Discovering ObjectsThe Data Perspective (contd)
- Look at organizational units that are relevant to
the system. - Look at physical devices that interact with the
system. - Look at external entities that communicate with
the system. - E. Yourdon
- Object-Oriented System Design An Integrated
Approach, 1994
20Discovering ObjectsThe Data Perspective (contd)
External Entity
Event
Data
Data
Device
Organizational Unit
Data
Place
Data
Data
Player
Data
21Discovering ObjectsThe Function Perspective
- Objects exist when they function.
- Identifying responsibilities of an object in CRC
modeling is a way to discover functions of
objects and thereafter the objects.
Object C
Object A
Functions
Object B
22Discovering ObjectsThe Function Perspective
Object Types
- ? Actor objects. Actors are people and/or
- organizations in the real world that
interact with the - system.
- ? Business objects. Business classes are places,
- things, concepts, and events that describe
that the - business is all about.
- ? Interface objects. Interface classes are input
- screens and menus that make up the user
interface of - the system.
- ? Report objects. Report classes are created for
any - printed or electronic reports or pieces of
output. -
23Discovering ObjectsThe Relationship Perspective
- System objects rarely stand alone, and they often
have relationships with other objects. - A relationship establishes a logical connection
among objects. - Relationships connect one object with another,
similar to the way verbs and verb phrases relate
one noun or noun phrase to another. For example,
Joe is an employee of the Information System
Department.
24Discovering ObjectsThe Relationship Perspective
(contd)
- There are two fundamental sets of object
relationship - (1) Generalization the IS-A relationship
(Class Instantiation). - (2) Association the IS-PART-OF relationship
(Inheritance and Aggregation).
25Discovering ObjectsThe Relationship Perspective
(contd)
Student
Person
IS-A
Employee
Department
IS-PART-OF
26Discovering ObjectsThe Behavior Perspective
- Objects have particular behavior, and behavior
has three basic components - (1) State An objects status, phase, or
situation. - (2) Condition A cause for an object to make
the transition from one state to another. - (3) Action An act of an object in a particular
state or transition.
27Discovering ObjectsThe Behavior Perspective
(contd)
- A closer look at the behavior of objects
typically generates the well-known
state-transition diagram. - By tracing the analyzing the state transitions,
more related objects can be found.
28Discovering ObjectsThe Behavior Perspective
(contd)
Object A
Object D
State 1
x
receive message x send message a
y
b
a
State 2
Object B
Object C
receive message y send message b
State 3
29Discovering ObjectsThe Behavior Perspective
(contd)
Object A
Object D
State 1
x
receive message x send message a
y
b
a
State 2
Object B
Object C
receive message y send message b
State 3
30Discovering ObjectsOther Tips
- Look for anything that interacts with the
- system, or that is part of the system.
- Ask yourself if there is a customer.
- Customer is a very common class.
- Follow the monetary transaction.
- Who, where, and how the money is spent.
31Discovering Attributes
- Analysis attributes. During the OO analysis
stage, these attributes become apparent. - Design attributes. These are attributes (e.g.,
print device) that do not surface until the
design stage. - Relevant attributes. List only attributes that
exist in the application domain. - Service attributes. List attributes that are used
by the methods of the object.
32Discovering Methods
- There are two kinds of methods private and
public. - Private methods are automatically activated by
the system when an object is accessed. They are
private because they are not seen and cannot be
used by the users.
33Discovering Methods (contd)
- Private methods can be defined at the class
level. For example, all employees salary are
within a range and can be enforced by a private
method. - Private methods can also be defined at the
instance level. For example, a private method for
editing a particular employees salary with a
unique range can be defined at the object level.
34Discovering Methods (contd)
- Public methods contain business logic and can be
invoked by the receipt of a message sent from
another class or object instance. - For example, the public method Calculate Salary
for the calculation of an employers salary is
defined and stored in the Employee class. The
method can be called to calculate the salary of a
particular employee.
35Discovering Methods (contd)
Object A
Object B
Object B
Public
Private
Method
36Evaluating Candidate Objects
- More objects does not necessarily mean better.
- The object structure and class hierarchy should
be manageable. - Candidate objects have to be evaluated before
they become permanent.
37Evaluating Candidate ObjectsCriteria
- Object independence. If an independent existence
of an object is important, then it may well be an
object. - Necessary remembrance. The proposed object should
have some data that it must remember. - More than one attribute. Most of the objects
have at least one attribute.
38Evaluating Candidate ObjectsCriteria (contd)
- Needed functionality. It is possible for an
object to have no attributes, but it is highly
implausible for an object to have no methods or
services. - Essential functionality. The proposed object
should have methods that are relevant and
necessary for the system.
39Evaluating Candidate ObjectsCriteria (contd)
- Common attributes. All the attributes of the
proposed class should apply to each instance of
the class. - Common functionality. All the methods of the
proposed class should apply to each instance of
the class. - J. Rumbaugh et al.
- Object-Oriented Modeling and Design, 1991
- M. Coad E. Yourdon
- Object-Oriented Analysis, 1991
40Applicability of OO Concepts
Object-oriented technology is applicable to the
analysis and design of any system of any size in
virtually any business area.
41Applicability of OO Concepts
- Abstract data typing (Modula-2)
- Generic processing (LISP)
- Semantic networks (AI)
- Simulation (SIMULA)
- Interface-based programming (Ada)