Jump to content

Do you use Object Oriented PHP?


moon 111

Do you use Object Oriented PHP?  

24 members have voted

  1. 1. Do you use Object Oriented PHP?

    • Yes
      15
    • No
      9


Recommended Posts

I almost always write my code procedurally - I have a basic understanding of OOP, in the way that I can use and modify classes that others have written (PHPMailer, jpGraph, FCKEditor etc.) But as far as writing and utilising my own, I have never attempted it. I have a book on OOP but have only read the first chapter or so - I just can't think of a situation where it would benefit me. Though, maybe my opinion would change if I had a better understanding of the subject.

Link to comment
Share on other sites

When I write simple test scripts, it's really a waste of time, but with any respectable project, there's no other way to do it.

 

SA: If you do it properly, it's very easy to implement a system that will save you a lot of time in development. Put the right directories in include_path, put the right code in the right directories, and fill in the __autoload function, and then all you have to do is make the new classname() call. __autoload takes care of the include or require call, and voila, you have your classes.

Link to comment
Share on other sites

SA: If you do it properly, it's very easy to implement a system that will save you a lot of time in development. Put the right directories in include_path, put the right code in the right directories, and fill in the __autoload function, and then all you have to do is make the new classname() call. __autoload takes care of the include or require call, and voila, you have your classes.

Hmmm, I have often wondered if OOP would speed up the development of my 'back-end' administration areas for projects, as they are almost always based on the same layout and similar functionality (create/modify/remove content fields) - I always start a new project by copying the contents of the previous project and modifying it to fit the requirements of the new one, improving things along the way if I can and writing new functionality if required.

 

I have "PHP 5 Objects, Patterns, and Practice" (APress), I bought it after a recommendation by someone on here. Although what I have read makes sense, it just doesn't outline the clear benefits for going OOP. I'd like an article that shows the same practical functionality coded in both procedural and OOP methods where the gains are obvious. I've yet to find one, does anyone know of such an article (or book)?

Link to comment
Share on other sites

  • 2 weeks later...

I generally tend to avoid it, usually because I can't see why using classes is any quicker than a function library. There probably is a reason, and I'd love to know it, but right now I don't see anything wrong with functions.

 

There is much more to OOP than just using objects/classes. It's not comparable to using a function library.

Link to comment
Share on other sites

I learned the theory behind object-oriented programming at uni (Java), and scored fairly well.  But knowing is one thing - doing is another!  I definately want to learn OO-PHP though, but not until I reasonable comfortable with procedural PHP programming.

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