download

Matakuliah
Tahun
Versi
: M0074/PROGRAMMING II
: 2005
: 1/0
MATERI PENDUKUNG
ELEMEN OBJEK
1
What Are Objects?
• At its simplest, object technology is a collection of
analysis, design, and programming methodologies
that focuses design on modelling the characteristics
and behavior of objects in the real world. True, this
definition appears to be somewhat circular, so let's
try to break out into clear air. What are objects?
They're software programming models. In your
everyday life, you're surrounded by objects: cars,
coffee machines, ducks, trees, and so on. Software
applications contain objects: buttons on user
interfaces, spreadsheets and spreadsheet cells,
property lists, menus, and so on. These objects have
state and behavior. You can represent all these
things with software constructs called objects,
which can also be defined by their state and their
behavior.
2
• In your everyday transportation needs, a car
can be modelled by an object. A car has state
(how fast it's going, in which direction, its
fuel consumption, and so on) and behavior
(starts, stops, turns, slides, and
runs into trees).
3
• You drive your car to your office, where you track
your stock portfolio. In your daily interactions with
the stock markets, a stock can be modelled by an
object. A stock has state (daily high, daily low, open
price, close price, earnings per share, relative
strength), and behavior (changes value, performs
splits, has dividends).
• After watching your stock decline in price, you repair
to the cafe to console yourself with a cup of good
hot coffee. The espresso machine can be modelled
as an object. It has state (water temperature, amount
of coffee in the hopper) and it has behavior (emits
steam, makes noise, and brews a perfect cup of
java).
4