DJ Mike's Tutorials: PHP

Introduction to Objects


< ^ >

Definitions:

Before creating a object, you need to learn a few new terms. Don't get hung up on not understanding these definitions all at once. If you don't get what a term is on this page, just move on to the next pages and come back here after seeing some examples.

Object Oriented Programming (OOP)

Object oriented programming is not just a different way to program with a different syntax; it as a different way of looking at programming. Objects are a self-sufficient bundle of variables and functions that model the thing that you are programming. For example, if you are making a program that models a car, the object will be composed of varables that describe a car, such as make, year, model and color; and functions that a car does, such as start, go forward, back up, turn right and turn left. An object will usually be on a dedicated file that you use by including it in another file. One advantage of this approch is that it makes your programs modular. An object is like a microwave oven. You don't have to understand how it works or be able to make one yourself; you just have to know how to plug it in and how to push the buttons.

Classes and Objects

A class is a templet or pattern from which objects are made. Going back to the car analogy, and class named "car", would include a list of attributes that a car can have and things that it does.

Properties and Methods

If you were not using objects, a list of attributes and functions of something would be called variables and functions. When used in an object, thay are called properties and methods and have a different syntax.

Instantiating

Instantiating is the process of creating an object. If you make a object named, "apple" from the class, "fruit", you are making an instance of fruit.

< ^ >


Created by DJ Mike from Santa Barbara

DJ Mike
Dance Away Santa Barbara's Home Page