SitePoint Sponsor

User Tag List

View Poll Results: Should PHP shed it's procedural roots?

Voters
25. You may not vote on this poll
  • Yes, it's about time, bring it on

    13 52.00%
  • No, definitely not (what a horrible thought)

    12 48.00%
Results 1 to 13 of 13
  1. #1
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Should PHP shed it's procedural roots?

    Not to pay too much attention to Java, et al but don't you sometimes get fed up with having to utilise PHPs inbuilt functionality in an OO environment, from a procedural perspective?

    Take for example, the file system...

  2. #2
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Whilst it's a wonderful thought, it's a bit late now sadly. PHP has been around for far too long to break compatibility in so drastic a manner now!

    What we really need is a new scripting language; some sort of blend between PHP, Python and Ruby.

  3. #3
    SitePoint Addict
    Join Date
    Sep 2006
    Posts
    368
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    im watching silverlight 1.1 development closely

    the prospect of my lighttpd/php/mysql linux based servers sending XML/JSON data to clients and have compiled C# on the clients browser (thanks to silverlight 1.1 plugin) do all the UI work quickly and efficiently is quite exciting, not to mention im getting sick of javascript as its slow and doesnt work same way across browsers


    as for php im already coding in OO php5, tho it needs alot more OO capabilities, namespaces will be with us in few months, then i hope they have proper unicode support sometime in near future, also proper overloading and partial classes would be nice

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston View Post
    Not to pay too much attention to Java, et al but don't you sometimes get fed up with having to utilise PHPs inbuilt functionality in an OO environment, from a procedural perspective?
    If by "inbuilt functionality" you mean php standard library, yes, it must and can be rewritten or wrapped around in OOP manner, just like MFC does for Windows API. While it would be nicer to have such wrappers available out of the box, nothing prevents you to write them by yourself in pure php. Most decently coded applications already use classes like Request, File, Date etc.

    Quote Originally Posted by trib4lmaniac View Post
    PHP has been around for far too long to break compatibility in so drastic a manner now!
    OO wrapping of the procedural API won't break compatibility, just like installing PDO doesn't break legacy mysql_xxx API.

    What we really need is a new scripting language; some sort of blend between PHP, Python and Ruby.
    Yes, this is the kind of thought that is behind the pihipi project. A new language, syntactically comfortable for php programmers, but more generic and without all that legacy rubbish.

  5. #5
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by trib4lmaniac View Post
    What we really need is a new scripting language
    I'm still waiting for a good PHP-like server-side implementation of Javascript.

  6. #6
    Obey the Purebreed trib4lmaniac's Avatar
    Join Date
    Dec 2004
    Location
    Cornwall, UK
    Posts
    594
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog View Post
    OO wrapping of the procedural API won't break compatibility, just like installing PDO doesn't break legacy mysql_xxx API.
    Well to truly "shed it's procedural roots" (that should be "its" not "it's" Dr Livingston ), support for the procedural functions would have to be dropped entirely.

    It would certainly be wonderful if the SPL was developed to a stage when it could replace the procedural API entirely.

  7. #7
    SitePoint Guru thr's Avatar
    Join Date
    Jun 2003
    Location
    Sweden
    Posts
    664
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BerislavLopac View Post
    I'm still waiting for a good PHP-like server-side implementation of Javascript.
    I soo feel you on this, love javascript - now give me a serverside implementation of it worth using .

  8. #8
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > ... but more generic and without all that legacy rubbish.

    That is the problem I suppose that would stop PHP from moving away from it's procedural beginnings, unfortunately. Wishful thinking as it may be, another problem would be how to introduce the revised PHP into an already bloated PHP market (supporting variable versions of the language as it is), and finding support for it, in regards that it's market share would be more limited (to those with the skills).

    > It would certainly be wonderful if the SPL was developed to a stage when it could
    > replace the procedural API entirely.

    Certainly, I could live with that but the SPL would need to be overhauled as, as it stands at the moment, as it doesn't go far enough. It's not well thought out either in my view.

  9. #9
    SitePoint Guru 33degrees's Avatar
    Join Date
    May 2005
    Posts
    707
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by thr View Post
    I soo feel you on this, love javascript - now give me a serverside implementation of it worth using .
    Well, there's definitely a lot of choice. Maybe the problem is simply that none of the implementations have reached critical mass?

  10. #10
    SitePoint Evangelist
    Join Date
    Mar 2006
    Location
    Sweden
    Posts
    451
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't mind that the language isn't OO, what bothers me with PHP is its inconsistent namings and the way functions takes arguments. Should $haystack come first, or should $needle? I've been using PHP for some years now, and I still find myself looking in the manual for basic stuff like that (but perhaps that's just my bad memory ).

  11. #11
    SitePoint Guru BerislavLopac's Avatar
    Join Date
    Sep 2004
    Location
    Zagreb, Croatia
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by 33degrees View Post
    Well, there's definitely a lot of choice. Maybe the problem is simply that none of the implementations have reached critical mass?
    No, but that none of them has achieved the simplicity of PHP'a installation and integration with the Web server. Most of all, none of them has a simple templating system as PHP does, instead using either classic function calls or convoluted solutions such as Whitebeam's XML.

  12. #12
    Put your best practices away. The New Guy's Avatar
    Join Date
    Sep 2002
    Location
    Canada
    Posts
    2,087
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    I would keep array functions and general purpose stuff like that, the way it is, as I am not in favor of abstracting things like strings and arrays and then giving them methods which clone the functions we already have. Thats ugly, and without the ability to overload operators it's really ugly.

    But, for more complex things which are easy to group in similar functionality I wouldn't mind. For example, session and cookie classes rather then functions.
    "A nerd who gets contacts
    and a trendy hair cut is still a nerd"

    - Stephen Colbert on Apple Users

  13. #13
    Floridiot joebert's Avatar
    Join Date
    Mar 2004
    Location
    Kenneth City, FL
    Posts
    823
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wysiwyg View Post
    I don't mind that the language isn't OO, what bothers me with PHP is its inconsistent namings and the way functions takes arguments. Should $haystack come first, or should $needle? I've been using PHP for some years now, and I still find myself looking in the manual for basic stuff like that (but perhaps that's just my bad memory ).
    Nah, I do the same thing & I still remember that 0073735963 takes you right to Mike Tyson in Mike Tysons' Punchout.


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
  •