SitePoint Sponsor

User Tag List

View Poll Results: How well would Java's class library API serve as a base for a PHP implementation?

Voters
58. You may not vote on this poll
  • It would work well with little modification.

    16 27.59%
  • It would work with significant modification.

    19 32.76%
  • A PHP class library would be better off not basing itself off the Java class library API at all.

    14 24.14%
  • Unsure or not familiar with Java's class library API.

    9 15.52%
Page 4 of 4 FirstFirst 1234
Results 76 to 82 of 82
  1. #76
    SitePoint Guru
    Join Date
    Nov 2002
    Posts
    841
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I somewhat regret announcing Wact on this thread -- I was a bit premature. Anyway, the code is checked into the SourceForge CVS now.

  2. #77
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    VA, USA
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    overhead, wrapping

    I think that a base library for PHP is essential, but I don't think that PHP is hurting for a base Object class -- there's the is_object() function which can serve the same ends, IMO. Along the same lines, I don't think PHP needs either a String or an Array class. Sure there are specific functions for both strings and arrays, but there's no reason for these to be wrapped with a class in PHP. PHP is a largely procedural language, if you want object wrappers for every data manipulation function then you probably don't really want to be using PHP.

    What PHP does need is a good "port" of some of the core Java classes that represent functionality that doesn't actually exist in the PHP language itself. For instance: Properties, BufferedReader / BufferedWriter, even File / FileReader / FileWriter would be nice. PEAR is beginning to provide some very good utility classes (e.g. Log, MDB, PHPTAL), but many of these are still very bloated by requiring the PEAR class, old error handling routines, destructor emulation, etc.

    I've been involved with porting Phing (PHP port of Apache ANT) to PHP5 -- http://phing.tigris.org ; Phing has its own versions of many of these core Java classes (especially the IO classes). Phing works with a great deal of wrapping & abstracting, but it also has the unique advantage of being a command-line build tool -- and therefore performance is not as crucial as a web-based application.

    Hans

  3. #78
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just for the hell of it I've started on a port of java.IO.File, as I can think of lot of uses for such a thing.

  4. #79
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    VA, USA
    Posts
    57
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Phil.Roberts
    Just for the hell of it I've started on a port of java.IO.File, as I can think of lot of uses for such a thing.
    Cool -- but you might want to start from Phing's port of File (and other IO tools):

    http://phing.tigris.org/source/brows...ing/system/io/

    -HL

  5. #80
    No. Phil.Roberts's Avatar
    Join Date
    May 2001
    Location
    Nottingham, UK
    Posts
    1,142
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hlellelid
    Cool -- but you might want to start from Phing's port of File (and other IO tools):

    http://phing.tigris.org/source/brows...ing/system/io/

    -HL
    Dang, and I was just getting into that as well.

    Oh well. No point in re-inventing this wheel I guess.

    [edit: Then again, I might just carry on as I was. Most of Phing is written for PHP5 so I'd probably end up spending just as much time porting it back to PHP4 as I would writing it from scratch.....

    Still, a good reference. ]
    Last edited by Phil.Roberts; Aug 13, 2003 at 17:42.

  6. #81
    SitePoint Guru
    Join Date
    Nov 2002
    Posts
    841
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by hlellelid
    What PHP does need is a good "port" of some of the core Java classes that represent functionality that doesn't actually exist in the PHP language itself. For instance: Properties, BufferedReader / BufferedWriter, even File / FileReader / FileWriter would be nice.
    Interesting. Not everyone is thrilled with the Java IO classes in Java land.

    This guy is harsh about it:
    Java I/O Sucks

    Others agree:
    Java I/O.. yah, it sucks
    A shining example of how the language makes it hard to do something amazingly simple
    One more...

    Some debate pro and con is here:
    Java IO Classes Are Impossible To Understand

    Quote Originally Posted by Phil.Roberts
    No point in re-inventing this wheel I guess.
    Indeed. I would love to see some side by side code comparisons showing how these these classes make it easier to do file IO versus the built in PHP functions.

  7. #82
    SitePoint Enthusiast siteartwork's Avatar
    Join Date
    Jan 2005
    Location
    Germany
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    FYI:

    I started a port of the Java API to PHP5. The project page can be found under http://phplang.tigris.org

    I'm a little bit concerned about Sun's Proprietary license used by the Java Api - but I'm already working on this.


    EDIT:
    Due to license issues the project has now moved to http://cucua.tigris.org
    Last edited by siteartwork; Sep 24, 2005 at 07:40.


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
  •