#1
  1. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    691
    Rep Power
    200

    OO Programming in PHP


    Hey everyone. In the company I currently work for I've developed a CMS in php with a lot of ajax for the front end stuff. On the backend I have an abstract parent class that has the common functionality for all the modules. Besides the general idea of using inheritance, abstraction, and generally making and using objects I don't think I know much else about using OO programming in real world situations. All the tutorials I've been able to find don't have good real world examples so I'm hoping someone can point me down a path to increase my OO programing skills, preferably in PHP.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2009
    Posts
    34
    Rep Power
    6

    Book Recommendation


    I would recommend getting the following book "Head First Design Patterns", I am in the middle of reading it and so far I am impressed.

    It is not PHP specific but it is very good at explaining soloutions to common design problems and has helped me in communicating with other developers.
  4. #3
  5. Code Monkey V. 0.9
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Mar 2005
    Location
    A Land Down Under
    Posts
    2,118
    Rep Power
    1990
    The closest thing to a "real world" example to something like that I can think of quickly, is cars. I'll tyr to make this not PHP-specific, as pretyt much eveyr OO language does the same things.

    class Vehicle
    var power
    var num_wheels
    var num_doors

    class Car extends Vehicle
    var brand
    var model

    class Motorcyle extends Vehicle
    var brand

    class Convertible extends Car
    var roof_down

    That's the basic idea. Start with a base class, and build things on top as they get more diverse. When it does, inherit/extend (terminology can differe depending on languages) from the class next back in the tree and keep going from there.
  6. #4
  7. No Profile Picture
    http://stealthwd.ca
    Devshed Novice (500 - 999 posts)

    Join Date
    Dec 2005
    Posts
    691
    Rep Power
    200
    Originally Posted by Catacaustic
    The closest thing to a "real world" example to something like that I can think of quickly, is cars. I'll tyr to make this not PHP-specific, as pretyt much eveyr OO language does the same things.

    class Vehicle
    var power
    var num_wheels
    var num_doors

    class Car extends Vehicle
    var brand
    var model

    class Motorcyle extends Vehicle
    var brand

    class Convertible extends Car
    var roof_down

    That's the basic idea. Start with a base class, and build things on top as they get more diverse. When it does, inherit/extend (terminology can differe depending on languages) from the class next back in the tree and keep going from there.
    Yeah I'm past this level already. I use inheritance and abstraction but that's about it.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    12
    Rep Power
    0
    OO PHP is really more important factor that stands out are productivity, organization, and efficiency.Thse all the things are realy become effective by using OO in PHP and it can save time or increase workflow. For organization, OO PHP can keep your code and files organized. By efficiency, OO PHP can make your project and future projects run smoothly.
  10. #6
  11. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2010
    Posts
    8
    Rep Power
    0
    Originally Posted by JulianRead101
    I would recommend getting the following book "Head First Design Patterns", I am in the middle of reading it and so far I am impressed.

    It is not PHP specific but it is very good at explaining soloutions to common design problems and has helped me in communicating with other developers.
    I've just started reading this, so far so good.

IMN logo majestic logo threadwatch logo seochat tools logo