Jump to content

What's the real benefit of OOP?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
GHOwner

GHOwner

    Newbie

  • Members
  • Pip
  • 8 posts
I've heard how it can help manage code better, implement features easily, and fix bugs faster... But I don't exactly see the difference (in terms of benefit) to procedural programming. Why make a class when a file of functions can do the same? If there really a performance trade off and how does it make it easier to manage than procedural?

I'm learning OOP in PHP5 right now, and just am not sure why it's so desired when it looks like it's doing stuff that could otherwise be done just as good in procedural. I'm sure there's a benefit as many people use OOP, especially large scale applications, but I'm just at a lost as to why.

Thanks Posted Image I just mainly don't understand why I would use OOP when including php files that contain the functions is essentially the same (at least from what I understand).

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
GUI libraries in other languages are a good example of this: you can create a basic object, like a form, that has the basic functionality of being resizable, etc. You can then inherit a child of the generic form object that provides you with additional buttons, dialogs, etc. Having a library that provides much of the functionality, but can have it extended is a nice feature.

There are a lot of techniques that you can implement with OOP that simply aren't as easy with procedural. Unfortunately, you have to dig around in implementing OOP for a while before you can effectively start learning how to use it.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
GHOwner

GHOwner

    Newbie

  • Members
  • Pip
  • 8 posts
Thanks for the info. I'm using PHP & MySQL Web Development (fourth edition) to help with my PHP ventures, though I understand the basics of programming such as variables, arrays, loops, functions, and have done a few projects to test it. Just hit the OOP chapter, and reading some of it is what made me become confused on the difference from the old style. I'm sure experience in building it will help me start to understand, but making mods or so off of existing models might help as well know how effective it can be.

Again, thanks for the info, it helps understand a bit. So, in a sense, OOP has better management/control than procedural if done correctly? I suppose looking more into it will help me see that.

#4
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
The biggest advantage of OOP is you can build a framework, and then create variations on the framework with minimal additional work.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog