The Basics of Object-Oriented Programming
since the first computer program was written, and with the rapid pace of
advancement in the computer industry, development this usually isn't the case.
It way of programming takes hold among the general programming
population.he explosion of interest in and use of the last has been.
Object-oriented programming is an attempt to model computer programs as
closely as possible on objects in the real world. Modeling in this case means
http://greateventsupport.com/flash/loading-external/loading-images.html
trying to use real-world concepts of objects in your programs. For instance, if
your program dealt with oranges, you would make orange objects.
http://greateventsupport.com/fireworks/applying-swatches-panel/index.html
However, for many years, the standard approach to developing all but the
simplest program was what is referred to as procedural programming.
With procedural programming, you would ask general questions about what
you wanted the program to do. Suppose you were writing a program to control
a soda-vending machine. In a procedural approach, you would split up the
process of vending a can of soda into a finite number of steps. You might split
it up into something similar to the following steps: therentalmaster
1. Wait for change to be dropped into machine.
2. If enough change has been taken, enable the soda choice buttons.
3. If soda selected is not empty, dispense soda.
4. Dispense any change.
Each of these steps would be a procedure, which is a block of code with a
name attached to it. Each procedure could pass information to every other
procedure. For instance, the first procedure would tell the second procedure therentalmaster
how much money had been added, and the second procedure would call the http://greateventsupport.com/flash/loading-external/index.html
first procedure again if there were insufficient money.
This process is a perfectly logical way to model a vending machine, and for
many years, it was how things were done. Unfortunately, programmers found
that the larger the program got, the more difficult it was to keep track of how
procedures interacted.
For instance, each of the procedures would have to pass information back and
forth to each other, so you would have to decide ahead of time what was the
important information to remember. Thus, procedural programming centered
around the process that needed to be programmed without much consideration therentalmaster
http://greateventsupport.com/flash/distorting/draggable-window.htmlof the objects involved and the relationships between them.
Also, and in some ways more importantly, it was hard to use the code that had
been written for one project in another. Because procedures and design were
so interwoven, it was difficult to pull out any one piece and put it into another
program.
Object-oriented programming is an attempt to make things easier and more
modular. It is based around the idea of looking at a problem as if it existed in
the real world and trying to find the objects that would make it up.
Try this approach on the soda-vending machine example. What objects would
make up the machine? The first and most obvious one would be the machine
itself. What important parts of the machine would need to be modeled? There
would need to be at least three objects to give basic functionality: therentalmaster
l A coin-intake mechanism
l A soda selection panel
l A soda dispenser
http://greateventsupport.com/flash/existing/external-swf.html
There are two main things to remember about each of these objects. First, each
of these objects has variables that keep track of what is currently going on
inside the object. For example, the coin-intake object would definitely know at
any given time how much money had been inserted into the machine.
Second, each object has a mechanism to allow other objects to communicate
with it. This process is known as messaging, and the parts of the object that
enable this process are known as methods. If you are used to programming in
other languages, methods are much the same as functions or procedures except
that they aren't just floating around in a program, they are attached to specific
objects. therentalmaster
http://greateventsupport.com/fireworks/applying-color-fil/applying-color-fills.html
Doesn't this feel like a more intuitive, and even more fun, way of
programming? You take the problem and divide it up in ways that you might
use in the real world. Certainly if you were to build a soda-vending machine, it
would need to have a coin-intake device, and by having an equivalent in your
program, the program seems to make more sense.
http://greateventsupport.com/fireworks/using-button-editor/using-colors-section.html
Moreover, dividing your program up into objects makes it much easier to
reuse parts of it in other programs. For instance, after finishing the
soda-vending machine, you may very well want to model a video-game
machine. If the coin-intake mechanism on the soda-vending machine was therentalmaster
designed for the general purpose of taking coins (always a good idea), you
should be able to take that same object and use it in the new program with no
changes to the coin-intake code.