PHP Succeeding Where Java Has Failed 610
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"
PHP is great stuff (Score:2, Insightful)
I suppose that's true in most jobs, though.
J2EE won't fail... (Score:5, Insightful)
PHP can do allot (Score:1, Insightful)
Will be? (Score:3, Insightful)
Help me out here (Score:5, Insightful)
I am prepared to have my mind blown here, can someone enlighten me?
PHP Desktop Apps?! (Score:4, Insightful)
Pardon me while I roll my eyes (Score:5, Insightful)
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.)
Re:Java failed because it's a slow toy. (Score:2, Insightful)
Both have strengths and weaknesses (Score:4, Insightful)
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.
Re:I am completely unbiased... (Score:5, Insightful)
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.
Re:Help me out here (Score:2, Insightful)
Here we go... (Score:2, Insightful)
J2EE has a very well-respected place in larger organizations. The support is fantastic, the tools are fantastic, and the language is actually very nice, once you truly get to know it.
I used to think that Java was slow and useless, but when I actually started writing a lot of it, I found that its really not as bad as everyone told me it would be. Java is becoming the new COBOL as far as business acceptance goes, its everywhere that it needs to be, from what I've seen.
PHP is good for its own uses as well. I started programming in PHP, and I've written dozens of website backends in PHP, but the Java families (and other OO languages like C++ or C#) are just more elegant for the larger projects, web-based and otherwise.
I wish PHP and PHP programmers the best. Go, spread to anyone you can, but stay away from me. I've found a new girlfriend, and her name is Object Orientation.
PHP, or Ruby? (Score:3, Insightful)
I've certainly found Rails to be a good fit with interfacing with a Jabber PostgreSQL backend [blogs.com]. Good times!
Apples and Oranges? (Score:3, Insightful)
Re:Guessed wrong again! (Score:3, Insightful)
PHP wins - it's economics (Score:3, Insightful)
I'm talking about the network effects [wikipedia.org] of PHP being available on every shared host in the world.
Try to find a cheap, reliable tomcat hosting service. Then throw a dart at a google search for "web hosting." You'll find that outside of enterprise, PHP is the lingua franca.
So if you're a poor student or struggling entrepreneur looking to make an experiment or prototype, you will naturally gravitate toward PHP (same argument works for mySQL/postgre v the world). And guess who will populate the next gen of enterprise?
PHP Succeeds Because It's Not Overkill (Score:4, Insightful)
PHP is procedurally oriented, works well, and -- most important -- is free. I can't convince my boss to touch it, of course, but if some names get behind it, it might become a much easier sell.
very biased article (Score:5, Insightful)
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
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.
Let's send an in email (Score:2, Insightful)
flamebait! (Score:2, Insightful)
Re:Guessed wrong again! (Score:2, Insightful)
I totally agree with the parent post, people mistake syntax with logic. I might be able to tell you every single reserved word, function, operand and whatnot of one language, but if I do not have the necessary logic to put all these words together in the right order, it is useless.
Language syntax can be picked up pretty quickly, logic not.
I risk being tagged elitist, but... (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.
Re:Cliche Elitist Reply (Score:4, Insightful)
* PHP sucks.
PHP has functions for practically anything you can imagine. Of course, I'll get into why it doesn't suck in the replies below, as this is a bit too general.
* PHP is for n00bs.
PHP is for developers who want to get something done quickly. The syntax is very easy to learn, and variables are loosely typed, but in my experience this doesn't mean that the language is flawed; it means that one can code up something without having to worry about unnecessary things like pointers, variable conversion and the like. And to be honest, in website scripting I've never come across a need for more advanced syntax than PHP provides in my five or more years of using it.
* PHP is usually poorly written.
This, unfortunately, is usually true. Because PHP is easy to use, it is often used by people who don't want to worry about writing good code either. But like everything else, there are varying grades of professionalism. PHP *can* be written well, it's just a case of taking the time to do so.
* PHP is a scripting language and you can't do anything but write web pages with it.
Scripting language, yes. But it most certainly can [php.net] be used for things other than websites.
* PHP sucks because the function names are inconsistent.
True, but this is why one has a manual. I've never been all that concerned about it.
* PHP is slow.
Actually, it's really not. Take a look at this comparison between different CGI modules for Apache [dmst.aueb.gr]: PHP actually outdoes Perl here.
* PHP isn't capable of working in a real enterprise.
I haven't had experience with integrating PHP into an "enterprise" situation personally, but I'll refer you to Zend's Enterprise PHP [zend.com] page for various reasons why PHP is indeed ready for the enterprise.
* Real coders use Perl.
Real coders use the tool that best fits the problem.
* PHP doesn't scale.
Now THIS is something I can definitely refute. I work for a company that creates mods for a PHP / Smarty-based online shopping cart known as X-Cart [x-cart.com] and I can tell you, PHP scales wonderfully, otherwise stores wouldn't use it as a base of their business operations. X-Cart is on the order of hundreds of thousands of lines of PHP code, and very commonly has tens of thousands of customers accessing it concurrently.
And yeah, I know you were joking, but hey, I was bored.
Java never seemed intregrated with the browser (Score:3, Insightful)
Unfortunately, the answer to "it's not fast enough" always seemed to involve a very heavy, expensive machine from Sun. Hrmm.
Microsoft's solutions always seemed inelegant to me.
PHP always was, and is, about making web applications and database interfaces very efficiently.
Why is it suprising then, that it would be adopted?
web apps all have the same problem: the browser (Score:5, 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.
As a Java developer with PHP experience... (Score:5, Insightful)
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
Re:I am completely unbiased... (Score:2, Insightful)
The problem with Java is that you can't really integrate it with anything other than Java itself -- Sun can teach Microsoft a lot when it comes to blocking third-party improvements. Until, as you say, gcj or any other piece of free software catches up, Java won't be usable. It died as a client-side language, and is struggling on the server as well.
Thus, the bottom line is: long live Larry Wall!
Re:PHP wins - it's economics (Score:3, Insightful)
But now I use Java, because I think it's much easier to work with, when you have teams of more than two people. PHP gives you too much freedom to be easily managed. It's nice for experimenting, for stuff you want to see right away, for complex stuff you don't have to maintain for others, too.
I like better the ability to have interfaces, standards, Struts, lots of things that make Java better for developer teams.
The same that the guys who start right now with PHP, they might or might not change.
Re:Help me out here (Score:4, Insightful)
People recommend Smarty because PHP feels pretty incomplete without it. And it's not about separating code from contentit's about separating business logic from display logic. And the syntax is really easy.
Re:Java failing? (Score:3, Insightful)
On the contrary, the article makes it very clear: Java is failing to provide income for Marc Andreesen.
Re:Help me out here (Score:3, Insightful)
Re:Will be? (Score:1, Insightful)
PHP's popularity is partially due to cost of hosting a PHP web site. PHP is just easier for hosting providers to setup and not as resource-hungry as a JVM. Shared JVM's are also a pain, because often times you really need to restart the whole JVM to get things to work (OutOfMemoryExceptions). So for a serious site, you'd want your own JVM, and that costs even more.
If Java hosting didn't cost 2.5 times as much as PHP hosting (and that's just for shared JVM), we'd probably see more Java-based sites. I know I'd like to have some place to host the Java web apps that I've written for fun. I'm just way too paranoid to host them on my home connection.
As for the languages themselves, I like Java for working on big projects. PHP I use for little hacks and simple web pages (as well as extending Drupal [drupal.org], or whatever blog software I happen to be using). Of course I've never been paid to work with PHP so I don't know the full extent of its capabilities.
Re:I am completely unbiased... (Score:5, Insightful)
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
Re:Help me out here (Score:4, Insightful)
Come again? You're saying that {$value} somehow separates presentation from code more than does <?=$value;?>?
Re:I am completely unbiased... (Score:3, Insightful)
The existence of badly written code that nonetheless works would be sign of PHP's success in that regard.
Re:Pardon me while I roll my eyes (Score:5, Insightful)
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.
Programming tools? (Score:3, Insightful)
> regarded programming tools, which make it easier for
> developers to write software that run on Windows.
Bleh. Windows doesn't even come with a compiler.
I think that's probably why a lot of developers like Unix so much - most systems come with a compiler as standard and the man pages give you all the APIs you need. Grab your favourite editor and off you go!
Re:I am completely unbiased... (Score:1, Insightful)
flexible and capable the language is in the hands of a capable programming team.
PHP having a decent (not grade compared to say Lua) object oriented model for a scripting language and a gazillion different libraries and extensions, can be compared much better to Java and JSP or even ASP; however I don't think it can be usefully compared to Perl without being unfair to either side. Note: I work with both PHP and Perl and find that on a day to day basis, these two are complementary to each other since they each do things very well that the other doesn't.
Just my 2 cents.
Frank
Re:Marc Andreessen is on Zend's Board of Directors (Score:1, Insightful)
Re:I am completely unbiased... (Score:3, Insightful)
I think it's a bit more readable than Perl, simply because Perl lets you get away with things that php does not. $_ leaps to mind.
But Perl gets a bad rep from people who write sloppy Perl code. If you break things out into packages and functions and aren;t afraid to use linebreaks, the code doesn't become an illegible snarled mess. The things I see that make most people throw their hands up are undocumented regular expressions...If you're good with regex you look at it and go, "eh, email address validator", but if you're not it looks like someone wiped their nose on the number bar while alternately whacking the shift key.
Re:Help me out here (Score:3, Insightful)
Re:Java vs PHP development (Score:3, Insightful)
I'm not sure why you think
a) this is a good idea to do in PHP, and
b) this can't be done in Java.
And, for a program which took us six months to develop in PHP, it would have taken at least fifty percent longer with Java.
And now it will take you at least two hundred percent as much time to maintain.
Re:I am completely unbiased... (Score:1, Insightful)
Why doesn't variable interpolation within an HTML page do htmlspecialchars()
OH BOY I totally agree with this. Passing data into the HTML without HTML-escaping by default is a STUPID design choice. It's liking building a DB access layer that doesn't auto-quote placeholders.
And on top of that, they make the name htmlspecialchars() so LONG. And PHP doesn't have function aliasing, so you can't give it a different name, you have to create a new function that calls it (waste of cycles).
I really wish PHP would get it's head out of it's ass and make the HTML escaping the default. Or at least give me an easy way to write my own template system (no, Smarty and bloat like that isn't what I mean.. I mean a *low-level* way to plug into the existing template system), OR a way to reliably audit existing templates and point out unescaped tags..
Think about it: If escaping is the default, and you forget to unescape, you get visible HTML in your page. Easy to spot.
If UNESCAPED is the default, and you forget to escape, you don't see ANYTHING wrong. Until a XSS attack is found in your app and posted to Bugtraq.
Dumb dumb dumb.
PS, another HUGE problem with PHP is that it's very difficult to cache the compiled bytecode (wait does it even compile to bytecode??) and/or keep data in RAM between hits. You have to download a third-party tool or hack something yourself with shared memory. If I write a big PHP app, I want to keep the compiled classes in RAM or on disk for more speed, like I do with mod_perl or Rails. What is the *reliable* way to do this in PHP?? I think it might even be impossible, due to the massive dependence on a global namespace..
Re:Help me out here (Score:3, Insightful)
It's nice to be able to give the people responsible for content and layout access to the files of the website, without giving them access to the code that actually contacts the database, has access to server globals, etc. You can enforce that sort of separation via policy rather than code, but if its only policy, there's a temptation to bend the rules, especially if you have a page designer who knows just enough PHP to be dangerous. Better to have a template system that doesn't give raw database access, and then have a backend that exposes the pieces of database data to the designers that they need.