Jump to content

Recommended Posts

I'm a pretty decent PHP developer, but I have yet to implement classes in my work, and I'll tell you why: I've never had a need to. I just plain and simple don't understand the need for oop when I'm working. I don't see the advantage of using it. What can I do through oop that I can't do otherwise?

Thoughts?
Link to comment
https://forums.phpfreaks.com/topic/14818-classes-vs-not-using-them/
Share on other sites

Using OOP is not a matter of extending the PHP code abalities. It's more a way to organize your code
so it becomes easier to extend a certain application or re-use your code. Classes are notting
more then a described object with the necessary variables and functions to manipulate the object.
For example, you can create a class user so any information is stored in this object for a regular website visitor.
But if you 'as webmaster' want to log-in you want more privileges. So you make another class superuser extended from the regular user class and you can re-use the function and extend them without rewriting them.
Your not going to [i]get[/i] the concepts of oop explained in a simple forum reply, hell, I have several books, probably 6000 pages of examples and theory and Im still just comming to terms with it.

I suggest... if your interested in the whys... a good place to start is the book [url=http://www.odioworks.com/download/TIJ-3rd-edition4.0.zip]thinking in java[/url], available free. ok... so its not php, but php and java share much the same syntax these days, and the oop concepts don't change.
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.