Forum Moderators: coopster

Message Too Old, No Replies

OOP Learning and Benefits

Need to learn and master OOP

         

mvaz

2:01 pm on Feb 16, 2012 (gmt 0)

10+ Year Member



I've been using and working with php for some time now. However, I have been reading a lot that OOP is the way that is most efficient.

Could someone in here explain what OOP is, and how it can be more efficient that structured programming. I would appreciate if an example is provided whilst trying to talk me through this.

I definitely would like to take the OOP route, but the very term 'class' confuses me.

If anyone knows any good resources, please advise.

Any help is highly appreciated.

incrediBILL

1:21 am on Feb 17, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The simplified way to think of a class is just a collection of functions and variables associated to a specific task.

For instance, if you wrote a class about file handling you would want to include a way to open, read, write, append, seek, close and maintain the file handle, etc., get the idea?

Just a lot of related stuff neatly packed stuff in a class OBJECT, as in object oriented programming.

Often OOP is very efficient for the programmer but adds layers and layers of crap bloating the software itself out of control.

An example I know too well was a project where we were going to make a library of existing code, which the raw library was about 100K, turned into a 500K monstrosity after the computer science freaks make it OOP, it ran so damn slow they all went OOPS!

Doesn't mean it isn't good for a lot of things, I use it all the time, but it has it's place and purpose and in the hands of the wrong people, it just gets in the way and can kill the project, which is almost did in the 500K case above.

YMMV

P.S. real programmers fixed the 500K OOPS problem, we took it away from the computer science freaks and made it work in the real world.