Page 224 - DCAP408_WEB_PROGRAMMING
P. 224
Web Programming
Notes 9.1 What is an Object?
In the real world, we already know what objects are. They’re the things we look at, pick up, and
use every day - things like our chairs, our telephones, and our computers. All these are solid,
tangible entities.
However, if we want to describe a telephone to somebody in abstract terms, we can do this by
talking about it in terms of its essential characteristics - what properties it has, what it can do,
and how we can interact with it. All telephones have these characteristics, and we can use them
to establish exactly how one telephone differs from the next.
So, for our telephone’s physical properties, we could say that it has a microphone, a speaker, and
a dialing pad. We could also say that it lets us do things, such as call someone and talk to them.
Our telephone will also tell us when certain events are happening: for example, if a friend is
trying to call you, your telephone will ring to let you know. This ringing will prompt you to
take some action, like picking up the handset and talking to your friend. As an abstract object,
our telephone has:
Certain properties that define and describe it
A set of things or methods that it lets us do
The ability to prompt action when events occur.
We can use these three attributes to describe physical objects and abstract concepts. In a few
minutes we will describe how these real-world ideas are replicated in software objects, but for
now let’s go a little deeper into our real-world telephone. By learning about what objects are, we
can then look at how to use them in a way known as object-based programming. In the object-
based way of programming, the application is broken down into a set of objects. In doing this,
you can build the application in a two stage process. Firstly, you create the objects you will need
in your application and then you set up the relationships and interactions between objects. Later
in this chapter, we will see how the objects of Active Server Pages relate and interact with each
other and allow us to build our applications.
Example:
Here is our telephone. To look at this as an object, let’s put down some information about it. We
will be classifying the information into three categories:
Things that describe the telephone
Things that we can do with the phone
Things that the telephone tells us and that we can react to.
218 LOVELY PROFESSIONAL UNIVERSITY