Slashdot Mirror


PHP 5 OO In 24 Slides

An anonymous reader writes "At php|works about a week ago John Coggeshall gave an interesting talk on object oriented programming using PHP version 5. Even if you couldn't be at the talk, his slides are available online which gives you a pretty good idea of what you can expect from the OO model. Java programmers will be pleased."

6 of 56 comments (clear)

  1. Error on slide 5 by Anonymous Coward · · Score: 2, Informative

    From slide 5:

    Member methods may also be declared final, preventing them specifically from being overloaded in a sub class

    s/overloaded/overridden/

    See here.

    1. Re:Error on slide 5 by Smallpond · · Score: 2, Informative

      I think AC is correct:

      PHP 5 introduces the "final" keyword to declare final members and methods. Methods and members declared final cannot be overridden by sub-classes.

      overload has a specific meaning.

  2. Re:PHP isn't bad by lphuberdeau · · Score: 2, Interesting

    It really depends on what you are trying to achieve but I used PHP CLI many times to solve quick problems. PHP's impressive function library makes it easy to do anything. Can you give me an example where PHP isn't suitable for general scripting?

    BTW, I agree PHP is better at web than scripting. Now back to the main topic...

    As always, Coggle (I just need to spread John's 'short' name) used his PHP girls in the slides.

    These are far from being the first slides about PHP 5 available. I had seen some from Zeev Suraski 1.5 year ago. Actually, about every PHP conference around the world ever since PHP5 was buildable had it's set of PHP5 slides.

    --
    Qui ne va pas à la chasse n'a pas de gibier
    PHP Queb
  3. Desperately seeking spellchecker by flockofseagulls · · Score: 2, Insightful

    If you bother to make slides for a presentation, and then publish them on the web, you should take the extra minute or two and run a spell check over them. Reading something that includes misspellings and grammatical errors every other sentence is not just distracting -- it makes me wonder if the content and examples are correct.

  4. "You're not Ali. You're not even...literate." by mcasaday · · Score: 2, Informative

    A much more better speled deskripshun of PHP5's OO language enhancements are is available from the horse's mouth

  5. Re:history of PHP OO? by kris · · Score: 3, Informative

    I'd like to hear more about who designed the OO features of PHP 4, and who (re)designed them for PHP 5.

    PHP 3 was a procedural language and designed as such. Rasmus made it that way, and when you look at the code for php.net, or other code Rasmus made or approved, you'll see that he has a case and a reason for all this.

    PHP 3 had so called classes and objects, which were just a fancy syntax for hashes of values and functions, added as a midnight hack by Zeev and Andi to the language. Also, that hack was severely buggy. I ought to know, because I tried to use it in implementing PHPLIB at that time, and filed over 60 bug reports against PHP 3 during the six release candidates for it.

    PHP 4 tried to extend PHP 3's object capabilities, but that extension was driven mostly by Zeev, who admittedly had little knowledge of or interest in OO. Also, he tried to model PHP 4's OO capabilities with the image of C++ in mind. During the PHP 4 lifecycle, I tried several times to nudge Zeev and the PHP community into the direction of Smalltalk and Objective-C, which provide an object model that is much better suited to a scripting language than C++'s model, and also is much more expressive, but my efforts were late and since I decided not to code to the Zend engine itself, somewhat fruitless.

    Zend, especially Zeev, did do his homework for the version 5 release, though, and redesigned all things OO from ground up. He did so in front of a backdrop of PHP being used more and more in off-web usecases, that is, PHP 4 slowly becoming a mainstream language leaving its little specialized corner of web applications. Zeev's idea was to provide the version 5 release of the capabilities that are needed for PHP to become a real scripting language that can be used in larger projects, without breaking to much backward compatibility, and with keeping the dynamic "scripting" capabilities and feel of the language.

    He succeeded superbly - PHP 5 provides the OO you need, and enables you to operate more within the mindset of a Smalltalk or Objective-C programmer than within the mindset of a Simular or C++ programmer. In PHP 5, objects are dynamically typed (class is a property of the object, not a property of the variable name), completely self-descriptive, and capable of delegation, emulation and posing.

    Try it out and do not let the syntax deceive you - this is not a C++ or Java like language, try Smalltalk and ObjC for size.