[snip] I still don't get what the big fuss of OO programming is about ...How many of us have done so? Could some one please point out another feasible advantage of OO programming a part from the fact that I would make someone else's work easier by using this style of programming... [/snip]
It's not just about style, as a matter of fact it has nothing to do with style at all. I guess this comes from mostly other programming venues... OOP is a method of making code more modular, containerizing things which logically belong togther by group. You can create special instances of the group, but you don't have to keep them if you don't need them. It also has the benefit of making code more reusable. I can create classes for things that I can use over and over again in various applications. As a matter of fact, I have a 'customer' class that I use in every application within the company. If the customer changes I can modify the class without breaking existing code. If I have a special customer I can create an instance of that customer reflecting special qualities not found in the customer class, and then discard that instance once it is no longer needed. In order to have that special customer I only have to add the special characteristics and inherit everything else from the standard customer class. Since scripting languages, like PHP, PERL, VBScript and others have traditionally (up until a couple of years ago) been "top down" languages, OOP has not caught on as quickly amongst web development enthusiasts. The folks at PHP readily admit that there are some things lacking in their OO implementation, and no matter what happens you have to use those classes with non-object procedures. And that is the same for every so-called OO language. An example that gets used a lot is the vehicle class. Think of all the different types of vehicles out there *cars *helicopters *trucks *boats *bicycles *hovercraft *buses *motorcycles *airplanes *scooters now think about the instances of cars (sub classes, if you will) *sedan *sports car *town car *limosine and think about all the brands a car can be *BMW *Ford *Toyota *Chevrolet *Audi *Mini-Cooper and think about the characteristics *four door *two door *hatchback Of course the above is a very incomplete example. But you can see where having a base class could help. Then other classes that inherit from the classes above that, and so on. The bottom line on OOP in PHP though? Use it where and when it makes sense. It is not right for every application or situation. But if you find yourself using something over and over again that is not a function (like a database connection scheme, I have that in a function which is included() when needed. I pass variables to it for all the required info) but rather describes an object or class of objects, you may want to set up a class. HTH! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php