Oh, object oriented programming is not that bad. I think it is simply a
matter of having the right person explain it to you. Regardless of what
you and others think about object oriented programming it is a much
better design than procedural programming by far. Let's look at this in
down to earth language you and others might be able to understand.
To begin with let's think of a specific thing you want to create in your
program such as a dog named Sparky. Well, what is Sparky?Sparky is a
dog. What is a dog? It is an animal of course.
So you might begin your dog Sparky by creating a class named animal. The
animal class might contain functions and variables specific to animals
such as height, weight, hair color, walking, swimming, etc.
After you have completed the animal class you could in theory begin
creating all kinds of animals, but it is not specific enough to create a
dog. So we will now create a class which inherits animal, but adds some
additional functions and variables to let our dog bark, roll over, wag
his tail, etdc. In other words instead of having to rewrite all the
animal functions and variables over again we can simply declare that the
dog class is an extention of the animal class so when programming the
two are joined by the compiler as one class. However, we don't have a
specific dog yet.
Now, at this point in the main part of our program we will want to
create a new dog object called Sparky. We can easily do so the same way
we initialize variables such as
which creates a new dog named Sparky for use in our program. Why is this
better than procedural programming?
The main reason is that the class structure allows you to devide your
functions and variables up by classification or type. Functions and
variables for animals goes in the animal class just as functions and
variables specific to a dog go in the dog class. Therefore all functions
and variables are directly associated with the type of object that you
want to create in your program. Functions and variables specific to a
horse such as trot will not be accessible to a dog object, nor will
barking be accessible to a horse object. It is really structured,
logical, and clean coding.
However, the advantages of object oriented design don't stop there.
Another powerful feature of object oriented programming is that you can
reuse the same code over and over again hundreds of times over. In other
words once you have created the necessary class or classes for a
specific type of object you can create hundreds of objects using the
same variables, same functions, etc over and over again without having
to rewrite one single line of code. Using our example above once you
have created your dog class you have all you need to create anywhere
from one single dog to one million dogs. When you initialize the objects
all you are really doing is telling the program to clone the dog class x
number of times, but let each dog object act independantly of each
other. This is vastly easier, faster, and more effective than a
procedural programming design where you might have to create hundreds of
variables, functions, etc by hand where object oriented programming will
allow you to simply clone them as you hav need.
Finally, I briefly touched upon inheritance earlier. What makes this
feature of object oriented programming nice is it allows you to extend
existing classes as needed without changing the base class or classes
you are inheriting. If you have a player class in a game engine and you
need to make a specialized player class such as a Jedi class inheritance
makes this job very simple. All you have to do is create a new class
called Jedi, and tell it to inherit the primary player class. In your
Jedi class you can add special functionality for handling the Force,
carrying a light saber, and other specialized functionality without
having to change the player class and game engine at all.
In terms of languages like VB .NET, C# .NET, etc the .NET Framework is a
massive library of classes, functions, and variables for doing all sorts
of programming tasks such as drawing windows, managing timers,
performing common math calculations, opening/saving files, whatever. It
is possible because object oriented design allows for some extremely
complicated programming to be done simply, and allows a developer to
create hundreds of buttons, timers, list boxes, etc simply by creating a
new instance or object of the proper class.Then, setting its properties
peter Mahach wrote:
I looked at object oriented programming and let me tell you it sucks.
if you're a newbie like me it's too much difficult turms and whatnot.
calling some sort of an api to set a hotkey to do something... is an
example I took from wineyes's script manual, which uses VBScript.
bottom line, object oriented programming would, if I was forced to use
it, would cause me to suicide from frustration, lol!
Gamers mailing list __ Gamers@audyssey.org
If you want to leave the list, send E-mail to gamers-unsubscr...@audyssey.org.
You can make changes or update your subscription via the web, at
All messages are archived and can be searched and read at
If you have any questions or concerns regarding the management of the list,
please send E-mail to gamers-ow...@audyssey.org.