SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Writing about Object Oriented PHP

    Hi guys,

    I am learning Object Oriented PHP and am writing about it on my website as I go along. If you are already experienced in it, I would appreciate any input you have as I go along and if you aren't, feel free to follow along as I learn!

    Thanks
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,457
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    oops

    I'm a bit of an OOP newbie myself. My brain is so hard-wired to procedural, that it's still like a foriegn language to me.

    OT, IMHO add some padding to the left content panel.

  3. #3
    SitePoint Zealot rhlowe's Avatar
    Join Date
    Sep 2006
    Location
    San Diego
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks for the feedback Mittineague, may I ask, what is your screen rez?
    San Diego Freelance Web Development Contractor
    Great Taste, no Filler. Now with no Trans Fat!

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,457
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    stats

    Off Topic:

    I have Windows OS using Opera 9.23 at 600x800
    Don't feel bad. It's hard enough to produce valid mark-up let alone flexible.
    My current blog theme - which is pink for October (a GeminiGeek design) - adds scrollbars at 480x640.
    My pages are valid and AFAIK are OK, except it bothers me a bit that it's a "hybrid". No nested tables for layout, but the "top level" body mark-up is a table to equalize the 2 column height.
    In fact, I am leaning away from "tweaking" the old pages (doable but tedious), and towards a fresh approach using OOP and MVC.
    By the time I figure it out, it will be time to learn something else.

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi Rhlowe.
    In my experience, people take to OOP better if you use one of your examples as people. For example:
    Quote Originally Posted by Some non-existent OOP PHP Tutorial
    A good example of the usage of OOP is a class which holds data about people. If you think of each intance of this class as a different person, and affecting one person can completely change him/her, whilst not affecting the other instances. For example:
    PHP Code:
    //give OOP example for a class holding data for a person. include functions like eat() and excersize() to manipulate different aspects of that person. 
    Notice how changing one person (instance of the person class) can change details about the person, while not affecting others.
    That kind of thing helped me to understand OOP better (although the tutorial was about JAVA (and I don't even know/want to know JAVA, I was just bored)).
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    If its about the explaining the fundamental principles of OOP to the novice programmer, then Java has got all the good books from what I have seen (The people who wrote Head First Design Patterns were my no#1 gurus).

    The PHP books (that I have read) have their place, and help us deal with the rigours of our particular PHP landscape. There are more appearing. Its great.

    Fowler uses mostly Java samples with some c# in POEAA - but if you have grasped the fundamentals, and use PHP5 (of course!) then you will profit from tomes like that.

    But, y'see, thats the beauty of it - the message and power of OOP transcends mere languages ... I can now happily read articles by Microsoft gurus and understand what they are talking about.

    Heres one of my favourite quotes from a comp.object discussion illustrating the "tell, don't ask" principle .

    1. You can get some object's guts, manipulate them and then reinsert
    the guts.

    Versus.

    2. The original object maintains its own guts and outsiders just "tell
    it", object.doYourThing ().

    Which is better?

    Approach 1 has guts everywhere. Knowledge about those guts sprayed all
    over the place. This here, that there. Mess.

    Approach 2 is simpler, easier, guts and knowledge of guts are in one
    place.

    Imagine a door bell.

    You need to open the box, get the wires out, know the wiring diagram,
    connect the wires, trigger the ring.

    Versus

    A black box with a shiny green button with "Press to ring door bell"
    written on it.
    Class.

    If you know your PHP5 OOP, and OOP fundamentals, all these gems are open for you to learn from. Our "particular PHP landscape" is evolving very quickly and I think its exciting to think about the patterns this will throw up - maybe patterns we don't yet recognise.

  7. #7
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    That's a brilliant quote there cups. I'll remember it next time i'm gutting them objects!
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •