Title: a very brief
1- (a very brief)
- Introduction to Objects
by Dr. Billy B. L. Lim
2- Why Object-Orientation Observation
- of attendees at OOPSLA/JavaOne continues to
increase - Products continue to surface in the market
- OO Languages
- C, Smalltalk, Java, Eiffel, Objective-C, CLOS,
Turbo Pascal, Ada 9X, OO Turing, Object-COBOL,
etc. - OO 4GLs
- PowerBuilder, Enfin, ObjectView, etc.
- ORDBMSs/OODBMSs
- Oracle 10g, DB2 Viper, SQL Server 2005, etc.
- ObjectStore, Gemstone, Versant, Ontos, OpenODB,
Trellis, O2, Orion, etc. - Class Libraries
- MFC, OWL, Tools.h, etc.
3(No Transcript)
4- 1. a thing that can be seen or touched
- 2. a person or thing to which action,
feeling, etc. is directed ... Webster's 87 - Objects are an attempt to associate more meaning
with data - Data and code together form objects
- Code associated with an objects (called methods)
define its behavior and provides services - An encapsulation of state (data values) and
behavior (operations) Budd 91 - People, places, and things (PPT)
5/ This is a struct in C / struct Student
char ssn char name
float gpa char major
struct Student s1, s2
6class Student / State / private
String name private String address private
float gpa private String major / Behavior
/ public void print() System.out.println(
"Name " name) // print other attributes here
Student s new Student()
creates an object of type Student
7class Student / State / char name char a
ddress float gpa char major / Behavior
/ public void print() cout ltlt "Name "
ltlt name // print other attributes here
Student s
s is an object of type Student
8- A number of people or things grouped together
because of likenesses kind sort ...Webster's
87 - A description of a set of objects with similar
characteristics, attributes, and behaviors.
LaLonde Pugh 90 - An abstract description of the data and behavior
of a collection of similar objects Budd 91
9- What is a Class? (cont'd)
- Templates (i.e., blueprint) for objects
- Object Factory
Telephone Class
Person Class
10Person object
a message
John Male 40
getAge()
int getAge() return age
40
a method
Methods are not stored with objects!
11- OO
- The Defining Characteristics
- Polymorphism
- Inheritance
- Encapsulation
- Easy to remember, just think of
- P I E
12- A object/class can extend the capability of a
previously defined object/class (Thine classes
or types shalt inherit from their ancestors) - Organization Generalization/Specialization
hierarchy
13- An object should hide things from other objects,
limiting visibility about what "I know and do."
Object International(Thou shalt encapsulate
thine objects)
Methods
Data
14- means many forms
- The interpretation of a message is in the hands
of the receiver i.e., the same message can be
interpreted differently by different receivers
(Thou shalt not bind prematurely)
SalariedEmployee
HourlyEmployee
15- ProblemWant to print a variety of objects from
a given container
Container
Square1
Square2
Circle1
Star1
Circle2
16- Traditional Solution // static, inflexiblep
first objectwhile (not end of container)
switch (p-gttag) case (square)
printSquare (p) case (circle) printCircle
(p) case (star) printStar (p) default
error() next p
17- Object-Oriented Solution // dynamic,
flexiblep first objectwhile (not end of
container) p.print() next p
18Traditional vs. OO Software Development
- Traditional
- based on top-down, functional decomposition"What
routines/functions are needed to solve the
problem?" - Object-Oriented
- based on bottom-up, object decomposition the
idea of objects that interact with each
other"What are the fundamental objects in the
system? what do they look like? How do they
interact with each other? What associated
routines do they need?"
19Traditional vs. OO Software Development (2)
- Traditional
- Object-Oriented
data structure
data structure
Function1
FunctionN
Function2
ObjN
Obj2
Obj1
Message
Message