Slashdot Mirror


PHP Succeeding Where Java Has Failed

ficken writes "Web browser pioneer Marc Andreessen recently announced his prediction that PHP will be more popular than Java for building web-based applications." From the article: "Wooing programmers is nothing new in the computing industry, where players constantly jockey to establish their products as an essential foundation. Indeed, many credit Microsoft's success to its highly regarded programming tools, which make it easier for developers to write software that run on Windows. PHP has caught on widely. About 22 million Web sites employ it, and useage is steadily increasing. About 450 programmers have privileges to approve changes to the software. Major companies that employ PHP include Yahoo, Lufthansa and Deutsche Telekom's T-Online." Meanwhilie, Piersky writes "Zend has announced its rival to .NET and J2EE, with the Zend PHP Framework. In a press release, they stated that it will be 'A Web application framework which will standardize the way PHP applications are built. The Zend PHP Framework will accelerate and improve the development and deployment of mission-critical PHP Web applications'. This will for part of Zend's PHP Collaboration Project"

28 of 610 comments (clear)

  1. I am completely unbiased... by Fortyseven · · Score: 5, Funny

    As a PHP coder and Java hater, I am completely in agreement with whatever the hell this article says. :D

    1. Re:I am completely unbiased... by SatanicPuppy · · Score: 5, Insightful

      Well, as a Java coder who's been coding almost exclusively in php for a year or so, I have to say it makes me feel better about my time spent. Php is definitely easy to work with, though that creates the opportunity for some seriously scary code.

      I have to say, just not working with Tomcat is a plus (though I give major Props to the Fedora team for the option to install Tomcat right off the install disks)...When gcj finally catches up, I'll be a happy puppy.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    2. Re:I am completely unbiased... by SatanicPuppy · · Score: 4, Interesting

      Yea. You can write good code in Php, but I've seen a lot of slop as well, and I've talked to a lot of "Php programmers" who don't know the first thing about datastructures---unsuprising since php really doesn't have anything besides a weird hash-array-stack thing with ad hoc support for multidimensions, and don't understand reusable objects or abstraction.

      Does definitely remind me of VB, though the syntax isn't as screwy.

      --
      ad logicam Claiming a proposition is false because it was presented as the conclusion of a fallacious argument.
    3. Re:I am completely unbiased... by LDoggg_ · · Score: 5, Insightful

      The problem with Java is that you can't really integrate it with anything other than Java itself

      Huh?
      Not sure what you mean here. If by integrate you mean communicate with other languages there's things like CORBA and SOAP, if you mean call other shared libraries there's always JNI if you can't find a java lib to do something.

      Until, as you say, gcj or any other piece of free software catches up, Java won't be usable.

      Strange, I'm using it every day at work. Have been in one way or another professionally for 8 years now.

      It died as a client-side language, and is struggling on the server as well.

      You do realise that is no better than a BSD is dying troll right?
      Just checked Moster.com. 105 java positions available within 50 miles of my house, 18 for PHP, 42 for perl

      Now I'm saying that as someone who also uses PHP. I've been using it quite a bit lately and don't mind it at all, but we're talking apples and oranges here. Sure PHP can be used to write monstrously sloppy and/or insecure code, but so can any language. PHP can also be used to write clean easily maintable secure code.
      PHP wasn't even close to java in terms of object oriented coding until PHP5 came out, which unfortuneatly has been very slow to appear on most 3rd party hosting servers and distros.

      My only real gripes with PHP are the lack of a standard DB connectivity layer like JDBC. PEAR:DB and ADODB are close, but they still rely on non-php libraries so setting up a connection to oracle or sql server is painful. The other thing is a lack of type hinting for primatives. Seems kinda silly to have to do a check if something is an int or double in the method instead of just putting it in the method's signature. I'm know its a loosely typed language, but type hinting is there as an option for objects, why not primatives too?

      I'm looking forward to PHP5.5 its going to have some real nice features that will bring it little closer to server side java and a little further from something like .asp where most of the business logic is in the presentation layer.

      --

      "If they have both, tell them we use Linux. And if they have that, tell them the computers are down." -Dave Chapelle
    4. Re:I am completely unbiased... by Mercano · · Score: 4, Interesting

      [Java] died as a client-side language.

      Not sure how much this is worth, but as we speak the top item on the Most Active Projects list over on SourceForge (insert tinfoil hat disclaimer here), Azureus is a client side Java app. For those of you keeping score at home, the #2 spot, GAIM, is in C and PHP comes in at #3 via phpMyAdmin. Keep in mind this is looking at quality (and a pretty wierd messure of quality, at that), not quantity, but still intersting.

      --
      #include <signature.h>
  2. J2EE won't fail... by _undan · · Score: 5, Insightful

    ... until companies who need mission critical systems have someone they can phone when something goes wrong, and some form of developer accreditation. Don't kid yourself. J2EE isn't picked because of the language, it's because it's got Sun and IBM (through Websphere) behind it.

  3. In other news by Anonymous Coward · · Score: 5, Funny

    Coke succeeding where peanuts fail.

    What? The two do different things.

  4. Re:PHP is great stuff by rovingeyes · · Score: 4, Interesting
    "If you are a web "programmer", it's definitely nice to have well-built tools that let you think even less about what you are doing and come up with something useful."

    Don't know about you, but it sounds dangerous to me.

  5. Help me out here by wren337 · · Score: 5, Insightful

    Doesn't PHP tend to be embedded in the page? I thought it was a more direct comparison to JSP than to Java. And like JSP I expected it violated the seperation of logic and presentation that I love so dearly. I've been avoiding PHP for the same reason I don't do JSP pages, I don't like code in the presentation layer.

    I am prepared to have my mind blown here, can someone enlighten me?

    1. Re:Help me out here by TheSpoom · · Score: 5, Informative

      You're pretty much correct. PHP is a lot closer to JSP or ASP than Java, and yes, it can violate separation of logic and presentation. However, you can use the Smarty templating library to separate code and presentation (and I recommend this to anyone learning PHP, because embedding PHP in HTML makes for very sloppy and nigh unreadable code).

      --
      It's better to vote for what you want and not get it than to vote for what you don't want and get it.
      - E. Debs
    2. Re:Help me out here by thePowerOfGrayskull · · Score: 4, Insightful

      However, you can use the Smarty templating library to separate code and presentation (and I recommend this to anyone learning PHP, because embedding PHP in HTML makes for very sloppy and nigh unreadable code).

      Come again? You're saying that {$value} somehow separates presentation from code more than does <?=$value;?>?

  6. Guessed wrong again! by MojoSF · · Score: 5, Funny
    I've resisted specialization for most of my career, giving me breadth but not depth. It's hurt me in job interviews where the hiring managers want specialized expertise instead of intelligence and problem solving skills.

    So I decided that I'd focus on Java for my depth. Now I read that I guessed wrong again!

    Maybe I should have gone C#/.ASP.

    No, Python and Zope are where it's at!

    No way, Ruby is the way to go. Arrrgh!

  7. Pardon me while I roll my eyes by Anonymous Coward · · Score: 5, Insightful

    "Java is much more programmer-friendly than C or C++, or was for a few years there until they made just as complicated. It's become arguably even harder to learn than C++," Andreessen said. And the mantle of simplicity is being passed on: "PHP is such is an easier environment to develop in than Java."

    This is just silly. PHP is far from "simpler" than Java. PHP *is* better suited to basic page generation tasks. Its syntax is easy to learn, and it's quick to get a page running. However, any sort of complexity thrown at the system starts making PHP look difficult and Java look easy. For example, I often write web applications that require that user sessions communicate with each other. Now this is stupidly simple in Java thanks to the use of Singletons or named derivitives. One can easily build a chat room, for example, whereas PHP begins to get a bit more tricky. Now throw really complex needs like PDF generation, Dynamic Excel Spreadsheets, XML/SOAP/XML-RPC/EDI communication, mainframe interfaces, off-brand databases, performance caches, and other large scale features, and suddenly Java doesn't look so hard anymore. PHP, OTOH, begins screaming for mercy.

    One would think that Andreessen would understand how to use the right tool for the right job, but apparently not. He should be kept away from the press. He always manages to sound 50 IQ points dumber than he actually is. (A common problem when dealing with the press.)

    1. Re:Pardon me while I roll my eyes by Crayon+Kid · · Score: 4, Informative

      However, the real strength of these systems is not in themselves; they are built on a superb platform base which provides Threading, IO, Networking, Graphics, Db access, i18n,and all the things a programmer might ever require. PHP doesnt have anything remotely similar, as far as i can see.

      OK, this is a troll if I ever saw one and may I be damned for feeding one but here it goes:

      Go look at PEAR and the PHP manual index and then tell people PHP doesn't have a platform offering all those.

      --
      i ate crayons when i was a kid and now i have two braincells and the blue ones taste nicer
    2. Re:Pardon me while I roll my eyes by coder111 · · Score: 4, Informative

      There's usually no need to integrate PHP with Java and use PHP for page rendering, because there are tools in Java that do page rendering just as well as PHP, if not better. If you need integration anyway, you can integrate Tomcat with Apache- then all your static (images, CSS) and PHP stuff will run on apache, for java stuff tomcat will get called. This will both increase performance (as Apache is better suited for serving static stuff than Tomcat) and allow PHP to be used on same box, same port.

      Java is not slow in server-side, it is just slow on desktop with Swing. Get Tomcat and try benchmarking some JSPs if you don't believe me. Templates with java might be slower than JSP, but anyway, page rendering is something that impacts the performance of web application the least.

      With java you EXTREMELY RARELY need to write extensions, usually you can find java libraries (most of them open source) that do the stuff you need. Or you can just use standart java class libraries, that are enough for 95% of cases. This way you can get a platform-independent solution for no additional cost. While your DLLs (.so's?) will have to be compiled for each architecture, coded to be cross-platform, installed by system administrators, etc.

      If you need to interface with C++/C, there is JNI (Java native interface, It is hairy and unfriendly though). Of you can integrate via some kind of interprocess communication (pipes still work, as will TCP, with java you can write TCP client/server in 10-30 lines of code). This way you can have any language on the other side of IPC. You can use webservices/CORBA/XML RPC if you want to be fancy.

      --Coder

    3. Re:Pardon me while I roll my eyes by hoggoth · · Score: 5, Insightful

      > One would think that Andreessen would understand how to use the right tool for the right job, but apparently not

      Andreessen knows exactly how to use the right tool for the job, like a surgeon. His tool is the media, and his job, as a new member of the board at Zend, is to promote PHP.

      --
      - For the complete works of Shakespeare: cat /dev/random (may take some time)
  8. Both have strengths and weaknesses by Anonymous Coward · · Score: 4, Insightful

    I've done programming in PHP and in Java.

    PHP is straightforward and easy, and most distributions have their own packages for it. Whereas with Java, the initial set up is overwhelming for beginners.

    I learnt PHP years ago by myself, and it wasn't really that hard. Yet a few months ago when I was finally required to learn Java, the complexity of the Java frameworks (Hibernate, Spring, etc) tortured me for days before I actually knew what was going on. And it doesn't help when all the frameworks gives such a "bulky" feeling.

    The learning curve of Java is definitely much higher than PHP.

    Of course, I do agree that Java is much better suited for large scale web programming than PHP. It's much easier to do things cleanly in Java, and although PHP's loose typing is great for a simple 1 page script, I'd rather have the strict typing of Java when it comes to large scale projects.

  9. Re:PHP can do allot by christopherfinke · · Score: 5, Informative
    I'm very impressed with how far PHP (Personal Home Page) has gone.
    PHP hasn't stood for Personal Home Page for a long time. It stands for "PHP: Hypertext Preprocessor."
  10. Marc Andreessen is on Zend's Board of Directors by ChrisRijk · · Score: 5, Informative
    http://www.zend.com/news/zendpr.php?id=107
    Zend Technologies, Inc., the PHP company and creator of products and services supporting the development, deployment and management of PHP-based applications, today announced Marc Andreessen and Gaurav Dhillon as the newest members of the Zend board of directors.


    Little "full disclosure" for everyone.

    PS There's more to Java on webservers than J2EE. There's also multiple Open Source versions of J2EE.
  11. Java vs PHP development by totallygeek · · Score: 5, Informative
    I am an owner of a software development company, and I can tell you that both have their place. All languages (and sadly, operating systems) are tools and it makes sense to use the right tool for the job. Languages we may be using depending on the task include C, Pascal, DataFlex, Java, PHP, Perl, Python, and even bash. Someone might ask why Pascal; which is because we have a well-defined set of libraries for that language which allow us to access many other applications, which in another language would be difficult or expensive to recode.


    All that aside, we typically use PHP for all web-based applications. The ease of coding, and the ability to affect change with zero downtime is a big plus. We can have several programmers affecting changes in one codebase in real time. And, for a program which took us six months to develop in PHP, it would have taken at least fifty percent longer with Java.

  12. very biased article by Philodoxx · · Score: 5, Insightful

    I'll come straight out and admit that I'm a Java programmer, but I've used PHP and I will admit it is simple to use.

    I find the comparison that the article makes between them is very one dimensional, it's saying that PHP is better than JSP, which I suppose is debatable (I prefer JSP ;) ). The problem is that Java is so much more than just JSP on the server side, it has an entire framework of technologies (some part of J2EE, some not) that make it a complete package. If they want to compare Java and PHP, it should bring in not only ease of development, but scalability, interoperability and security. I would have also liked to see the number of commerical websites running PHP vs the number of commercial websites running Java. For instance my home page has TorrentFlux on it, which is php based. So I guess I fall into that 22 million, although that's not really by design.

    I won't try and say Java is better (because of my limited PHP experience) but if an author wants to convince me that PHP is better than Java, it's going to have to talk about more than simplicity and hype.

    --
    Oh, a lesson in history from Mr. I'm my own grandpa.
  13. I risk being tagged elitist, but... by Snowhare · · Score: 5, Insightful

    PHP is and will be continue to be popular with the masses simply because, like HTML, the entry barrier is very low. It will fail to make deep inroads at the high end for the same reason: The entry barrier is very low.

    Sounds like a contradiction? Not really. The entry barrier for PHP is so low that we are seeing zillions of poorly written, insecure and unscalable PHP apps written by amateur programmers. Resulting in numerous security scares about PHP and contributing more than slightly to the infamous Slashdot Effect where a site that gets a sudden traffic surge craters as it runs out not of datapipe but simple CPU power. This scares the hell out of anyone who considers using PHP in the enterprise.

    Don't get me wrong: It is possible to write good, secure, scalable code in PHP. It just isn't very common.

  14. Re:PHP Desktop Apps?! by Dukael_Mikakis · · Score: 4, Funny

    It's a great project, but is definitely not meant for large-scale apps.

    What are you talking about? I'm posting this right now on my php-coded web-bro&%($(*#&%#&@&NO CARRIER

  15. web apps all have the same problem: the browser by helix_r · · Score: 4, Insightful


    Web apps all have the same problem. They use a goddamn BROWSER as the application platform. This sucks.

    I'm looking at a typical jsp right now. Its an awful demoralizing conflation of xml, css, jstl, html, and javascript-- all in one file. As developer, it sucks to work with and it is a major hassle to create a nice user experience with this trash y stuff.

    I have not worked with PHP, but looking at the source from the browser page, I imagine the same problems apply.

    Whatever happened to the "applet" concept? True, there were problems with it initially, but one would think that these problems could have been solved by now. Instead, the industry turned away from nice clean designs to the brutal mess that is today's web app.

  16. As a Java developer with PHP experience... by pico303 · · Score: 5, Insightful

    ...I can honestly say I avoid PHP at all costs. PHP feels like it was built by committee: there's no consistency in the language. Even with 5 I still feel like I'm hacking together web pages.

    I feel like there's a lack of standardized libraries for PHP. I've used PearDB, but it's sure not ActiveRecord or Hibernate. Smarty's o.k., but I'm already developing in a template language for HTML pages, why do I need another one? It's like working with JSP tag libraries (which I find equally wasteful).

    Fundamentally, I think the tight coupling between view, controller, and model that PHP naturally engenders is bad. Practically, I've seen where Ruby on Rails has gone in just a single year, and it's further than PHP's gone in the last 5. Things you can do in Rails in a few days take weeks of coding in PHP, even with the help of third-party libraries.

    PHP has a strong foothold with small, inexpensive ISPs, which is the only reason I think that people still use it. Unfortunately, the "war" between 4 and 5 has really hurt the credibility of PHP moving forward. Does any ISP support PHP 5?

    If PHP wants to compete against Ruby on the low end and J2EE and .NET on the high end, it's going to need new development tools--both for writing the code and useful libraries, stronger leadership, and a clear plan for the future. I don't see any of this happening in its current state. I consider myself to be a PHP outsider these days, and looking in it doesn't look so fun in the pool.

  17. Re:Since When Has Java Failed? by drew · · Score: 4, Funny

    There is a reason that eBay handles 1 billion transactions a day on Java.

    Because they run it on a million servers?

    --
    If I don't put anything here, will anyone recognize me anymore?
  18. What about the long run? by RAMMS+EIN · · Score: 4, Interesting

    I have to wonder about the long run here. When I work with Java, I find it a pain to work with, because of all the required boilerplate and the inflexibility. Things have probably gotten better with Java 5, but Java has been a pain in all the years before it.

    When I work with PHP, I find it a pain to work with, because of its apparent lack of design. It feels like a cobbled-together heap of features and hacks, and so does the code written in it. I tend to write cleaner code than what I've seen from other people, but that doesn't make the final product any less messy when various people have worked on it.

    Neither language is absolutely horrible; comparing them to others, Java is a language with a relatively clean design, and PHP is a good choice in its niche of writing web applications. However, my pain in working with these languages is a direct result of these languages being poorly designed. I'm into programming languages, and I know many that have better designs than Java and PHP. I wonder if these languages won't take over in the future.

    Some changes are happening already. Various organizations are moving away from Java for web applications, and I know others that would do well to do so as well. Much of the work that went into PHP 5 comes from a realization that earlier versions were flawed (the same can be said of Perl 6). Ruby appears to be on the rise. Paul Graham and others have had good results employing Common Lisp for web applications.

    The only thing I can see standing in the way of better languages taking over the web application sphere is the fact that the decision making process is based more on fame than on qualities. I maintain that Java has become so successful largely because of the enormous hype surrounding it. PHP, Linux and MySQL have also risen largely due to hype. Of course, it's true that you won't overly disadvantage yourself if you use whatever most others use, but it would still be better if decisions were made based on sound knowledge of technical benefits.

    --
    Please correct me if I got my facts wrong.
  19. J2EE Sucks by multipartmixed · · Score: 4, Funny

    I don't write in either Java or PHP -- I'm a Grade-A C-slinger -- but here are my REAL-WORLD experiences with both platforms.

    C Coders perspective:

    PHP - I wrote some objects for PHP5 about eight months ago. The documentation blows, I had to use gdb and a notepad to figure out some of the idiotic details for accessing the symbol table and so forth. The Horrible, horrible dangling-if-macros are terrible. Took 3 days (from "I know nothing" to "I'm done and debugged").

    Java - I wrote some JNI interfaces. Actually, they interfaced to the exact same code as the PHP5 modules! (Making a useful C library, encapsulated in C++ objects usable across Java and PHP platforms). Easy stuff! I used cxxwrap. Took 1 day.

    Manager's Perspective (I wear that hat, too): PHP is pretty cool, as long as you treat it like a programming language and perform proper data abstraction, code layout, blah-de-blah. "Web guys" need to learn awful fast that "Web Programming" had better be treated the same was as system programming, or large applications become difficult to manage. PHP does little to enforce this (hey, just stick some code right in the middle of the style sheet!), but good discipline will solve all of PHP's major problems.

    It's also nice when PHP the guys ask for help, I say "C library function XXXX will solve your problem" or "the underlying OS call behaves this way, that's probably why you're having issues..." and it transliterates directly into PHP. (And I can look at the PHP sources and actually understand them).

    Java, on the other hand -- I can't take my years of experience with the UNIX OS and help anybody coding on Java, because it has absolutely nothing in common with the underlying OS, POSIX, etc. Now, that may not be all that bad, but it's damned frustrating when you plan on doing common, every day operations that work anywhere else BUT Java, and have the platform smacks you in the face.

    For example, say you need to link two different web hierarchies together (say, images from your apache server and the same images in your tomcat container). You'd make a software link, right? OH, NOOOOO, you make a soft link and then you spend the next three hours figuring out why the fuck it doesn't work, because those asshats who designed the platform didn't like them, so you instead have to hunt through cryptic XML configuration files to find out how to turn on some asshat undocumented directive to allow a BASIC FUNCTION OF THE OPERATING SYSTEM.

    For fuck's sake! Now, I suppose the above criticism is more a J2EE criticism than a Java critism, but, if we want to compare apples to apples, .php vs. .jsp seems right on target. So let me enunciate very clearly:

    J2EE SUCKS HUGE DONKEY BALLS.

    Essential redux: Each PHP guy gets more done in a day than two Java guys get done in a week.

    Why? How can this be? Java solves everything except world hunger!

    The Java guys spend three days a week debugging shit that's gone wrong with Tomcat on one server or another. It's always some incompatibility here, surprise-bite-you-in-the-ass-there. Two applications on the same server use the same JAR file, so the containers refuse to load. That sort of thing. Sheer idiocy.

    Then they spend one day debugging shit that's gone wrong with Eclipse (or its mangling of the CVS repository, or some ant dependency problem, or)... then they spend half a day each writing code, and another half day synchronizing their changes. And meanwhile they whine that 256 megs of RAM isn't enough to edit a fucking text file (and do NOTHING else at the same time).

    And Lord help you if you want to add another table to the database and want them to do something as silly as retrieve the data from it and put it on a web page. Apparently, this is incredibly difficult, because it involves creating new hibernate objects, which of course fucks everything else in the ass, well, because, something called hotspot didn't get it's monthly fucking hormone shot or som

    --

    Do daemons dream of electric sleep()?