Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

OOP in PHP.

ADMADM
edited May 2006 in Vanilla 1.0 Help
Ok aside from easier to maintain code and such why is so many people opting to use OOP when dealing with PHP?

Judging from the following article it's not very efficient in terms of execution times:
http://www.webmasterstop.com/56.html

First let me clarify that I have no experience at all in OOP with PHP and basically the most I've ever gotten in PHP programming is dealing with functions.

Is it worth it for me to learn OOP? If I was to get a developer job would they look for OOP experience? Majority wise I mean.

Now if it is better for me to learn OOP, where can I start? What's the best book or site for me to read?

Comments

  • if you plan on programming really complex projects, then you should learn how to OOP i on the other hand, learned java as my first programming language, so thats all i know how to do really
  • MarkMark Vanilla Staff
    If you understand and appreciate OOP, it's way more fun to program. Period.

    If I were to venture a guess as to why people are opting to do more OOP with PHP, it's because they were inspired by my work with Vanilla.

    I kid.

    It's because PHP 5 has way better OOP support and it's not slow like it used to be.

    Do you need it for a programming job? It depends on the type of job you're looking for. I'd say that with simple web programming jobs, you're still very safe just knowing basic php.

    As for where to learn OOP, I don't really know. I didn't go to school for programming, I taught myself everything I know, all through trial and error.

    *puts on geek hat*
  • Ive been thinking about the same thing.

    I can code normal php just fine. No real problems, also all self taught. I have been thinking about learning OOP, but it is like starting all over again. Not knowing anything. I really like how clean the code is and easy to navigate... but is it really worth learning? I cant decide. And I have not come accross anything to help me in my decision either.
  • i hear this question all the time and i still don't understand it. it's just like having a new tool in your toolbox. you don't go around fretting over whether you should buy a jigsaw, you just know that it would make some things easier, and so you get it. and it takes a while to get used to it, but it doesn't make you forget how to use the hand saw, and you know you don't have to use the jigsaw every time you just want to cut a board in half.

    sorry, late night = bad analogies.

    Design Patterns is a great classic OOP text. and i also really recommend Thinking In Java by Bruce Eckels, which i'm pretty sure is available in a free ebook form.
  • Thanks guys. Mark, you were a bit right in that I started looking into OOP because of Vanilla ;) I think it's a good example of clean coding and I would like to eventually make something like this (not a message board, but an extension based script). I'll look into OOP some more and try out some tutorials and such and give it a go :)
  • In the end, most OOP code is written in such a way where you can easily recycle it into any other projects. It's not just that one shot script you wrote 2 years ago, it's a class with multiple functions that you could utilize for any other number of projects without having to rewrite it from scratch. I think that's the main bonus here. I think programmers have just recently gotten sick of reinventing wheels so that's why you're likely to find more things in OOP style :)
  • ithcy: That actually did make sense, and now I understand. I see the light.
  • becoming ancient but classic theres object technologies a managers guide... best intro to oop concepts text out there for my money as for oop in general its certainly something you'll want exposure to... you'll run into it fairly often in everythring from php to javascript to flash... whether its always economical or right for the work you run into on a day to day basis is another issue to confront once you understand it enough to follow some code and implement other people's objects / frameworks / etc.
  • Also, the main appeal of OOP in a nutshell is how simple and portable the code is normally if coded right the first time. You're not left wondering months or years down the road when you open up a random file and wonder "what the hell is this, and how do I strip it back down to be 'basic' again?". And as far as portability goes, you only really need to translate about 30% of the code at most if you're lucky to work in another language as most other languages these days already share the same constructs (albeit different function types/calls) but it's roughly pretty easy.
This discussion has been closed.