Jump to content

Recommended Posts

Hey all,

I've just got the hang of object oriented programming, and am considering switching my site over to using classes.

 

But then I thought...is there any real benefit of doing this? Is there really anything a class offers that a simple function can't do?

 

So I thought I'd ask here for some advice :)

 

Any pointers are greatly appreciated,

Jack.

Link to comment
https://forums.phpfreaks.com/topic/150634-functions-vs-classes/
Share on other sites

That's what I thought...but then I hear people bragging about how they can code "object oriented" etc...

 

But in the end, you just end up with heaps more code, and apparently they're slower.

 

Yeah...this has deterred me from using them slightly...

 

And thorpe, that's what the purpose of this topic is for; to help understand more about object oriented coding. What's the point in using OOP? I'm just interested.

Link to comment
https://forums.phpfreaks.com/topic/150634-functions-vs-classes/#findComment-791304
Share on other sites

But in the end, you just end up with heaps more code, and apparently they're slower.

 

You may end up with more code, but likely better designed and easier to maintain.

 

You should take a look at one of the bigger frameworks. Zend. Even just doing the quickstart tutorial will give you a good overview of some of the benefits of good design.

Link to comment
https://forums.phpfreaks.com/topic/150634-functions-vs-classes/#findComment-791311
Share on other sites

Yes... I agree with thorpe. It is easier to manage and maintain if it is in a class. Well maybe I did understood a bit about OOP since I started doing it with Java. In PHP, I do use some classes but not to all part, some part where I think it would be better for a class they I make a class for it, if not, I won't. IMHO

Link to comment
https://forums.phpfreaks.com/topic/150634-functions-vs-classes/#findComment-791387
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.