Jump to content

Archived

This topic is now archived and is closed to further replies.

insaynewrapper

Classes vs. not using them

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

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.