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"
Re:PHP is great stuff (Score:5, Interesting)
Don't know about you, but it sounds dangerous to me.
Caching (Score:2, Interesting)
I don't know much Php but as far as I can tell there is no way to do this natively. This is one of the reasons I don't use php. You see site like groklaw get overloaded when Slashdot hits them because they pull the freaking article out of the database every time it's requested.
If somebody could show me some in process caching that'd take me a long way to ditching php. I don't mean caching to disk either. Caching to disk is much slower than memory.
Ideas?
AC.
Re:Help me out here (Score:2, Interesting)
On the flip side, I've been working with Ruby on Rails [rubyonrails.org] and it's beautiful. Scripts to generate the starting points for your web files, separation of design and implementation, a great framework. Only thing it lacks is a strong IDE (as far as I can tell) behind it and extensive documentation or resources on the web if you hit a wall (PHP sites are everywhere, for example).
lingo... overload (Score:2, Interesting)
Seems like every post mentions some form of standards or framework, and everyone wants to standardize everything within a framework. Or perhaps make a framework which will help standardize everything. I can't stop saying standards framework.......standards framework..... I miss the old days when "ware" was the hot term.. webware..awareware..opencourseware..cookware..
On topic.. Php is just so much more fun then Java... (except when you're first loading it into Apache for Win and Apache just tells you "failed").. And I visit phpclasses.org almost daily, just because there is lots of cool stuff there to try and play with. Kind of like javaboutique, but not as stale..
I do think it is an exaggeration to say Java is failing.. Although C#/.NET seems to peck away at the domination every quarter.. Way off topic: Does anyone have a website which lists the "top skills" as listed in job postings online? I used to visit such a site for jobs in the UK but can't find it anymore, and doing a search on google for "top skills job postings C# Java" is a fruitless endeavour.
Bitter (Score:2, Interesting)
Re:Pardon me while I roll my eyes (Score:2, Interesting)
Re:PHP Desktop Apps?! (Score:3, Interesting)
Actually, php-gtk is very useful when you have an existing PHP web app that you want to port into a desktop app. It's a great project, but is definitely not meant for large-scale apps.
Success through lack of hype (Score:3, Interesting)
- it's used on its merits, not because of hype, or a New Gospel of Platform Independence
- it's simpler and faster
- it's not being touted by a huge company such that it shows up on MS's radar as a challenge
Re:PHP is great stuff (Score:3, Interesting)
Re:Help me out here (Score:3, Interesting)
Templating is part of the solution, but so is good app design. If you don't want to mix your logic, you simply need to code it that way. Zend PHP Framework will help enforce some of the same separation as Java does, but it's not strictly necessary. You can do MVC app design without much trouble. Take a look at Sitepoint's PHP Application Design forum (http://www.sitepoint.com/forums/forumdisplay.php
There are also Ruby on Rails-type frameworks such as CakePHP (http://www.cakephp.org./ [www.cakephp.org]
PHP: good for admins, not so good for developers (Score:4, Interesting)
PHP is good for an admin to set up some forum, photo gallery, database administration front end, a CMS, whatever tool you can download form sourceforge and install in a few hours to give users/customers a service.
When you need to develop a solution with specific needs and there's no tool to download and use right off the shelf, PHP gives you lots of headaches.
The API changes a lot, very fast. This is not good. From PHP 3.0 to 4.0 things break and new stuff gets added so fast some sites have to keep using PHP 3 in order to avoid spending many hours recoding old code. Now PHP 5 is a new language altogether.
Lots of changes are for good since PHP was really bad in some areas in early version so the rewrote everything form scratch, that forces developers to relearn and recode.
The lack of abstraction in the PHP API leaves lots of stuff to the developer. For example, working with HTTP headers. The header function just sends whatever header you send in. You have to account for browser bugs on your code and maitain that. The manual is full of user comments regarding how to use certain function that give different results with different databases, browsers, platforms, Apache configurations, etc. Those things don't belong to API, there are bugs, but you have to work around them in your code.
If you use a PHP CMS or a PHP forum, you know the people developping it will do the dirty work for you and release a quality product, but for a small organization with a few programers, migrating from PHP3 to PHP5 to get the new cool stuff they implemented is hard, painful and takes a lot of debugging time.
In contrast Java has managed to keep backwards compatibility while adding new functionality and the API has been quite stable. Of course it has bugs, migration problems and imcompatibilities, but the java developers (SUN, Apache foundation, IBM, etc) make an effort to make developers' life easier. The PHP developers also try, but are less sucessful.
At the same time in Java you don't have such a wide selection of free tools ready to use in a web site, but you do have tons and tons of libraries ready to be integrated in your java web app, which PHP has but in much smaller quantity.
This is an API complaint, not a language complaint (Score:4, Interesting)
Mailer.mail(to,from,subject,message,header1
Many java frameworks are terrible, but that's a matter of API aesthetic. For instance, I hate the Java frameworks' APIs for reflection and dynamic method invocation and such. So I wrap it all in two methods
public boolean canPerformMethod(String methodSignature);
public Object performMethod(String methodSignature,Object param1
(Note: the above is pseudo-code so I don't have to explain how to do variable number of parameters in Java 5 - not all
(Note2: By using aspect-oriented programming, I can insert these methods high-up in the object-hierarchy)
The point is that now, anywhere in my code I can dynamically invoke methods by:
Foo result = null;
if (target.canPerformMethod("processFoo:String:Foo")
result = (Foo)target.performMethod("method:String:Foo","Pr
}
That simple structure replaces about 10-20 lines of exception handling, method lookup, and all sorts of crap, because I (wait for it) encapsulated it.
I'm not saying it's not convenient to have mail(...). Of course it is. But the point of languages like Java is that if you have a preferred API, you can wrap the complexity of a crappy API with a nicer convenient one in your own code. That's called good programming. No actualy need to whine.
It's only when the raw functionality is not there, or when the raw langauge/runtime capabilities don't actually allow you to create the functionality you want in a convenient form - that's when whining is necessary. But modern Java, with Java 5 + aspectJ pretty much allows anything to be created in relatively convenient APIs.
The only remaining issue is to convince someone at Sun to refactor their core APIs into something that provides some of this convenience out-of-the-box. Or go write Objective-C against the Cocoa APIs on MacOSX. They're pretty nice.
Since When Has Java Failed? (Score:4, Interesting)
Try doing this [verosystems.com] in PHP.
There is a reason that eBay handles 1 billion transactions a day on Java.
Re:Here we go... (Score:2, Interesting)
Doesn't Java have like 5,000 built-in classes, let alone functions? And then the web page support adds on more classes and more functions. This is not the sign of a well designed language...
(And, yes, they are the same things. Most of those "3,000 built in functions" are actually libraries. You can strip them out if you really wanted to. I have no idea how you'd strip out the massive Java library bloat, though. Probably why Java's runtime comes in at like 400MB (410 MB on my machine, but that includes the docs), while PHP boasts a slightly trimmer and more functional 20MB or so runtime.)
The problem for casual Java is hosting (price) (Score:2, Interesting)
It's not difficult to see why Java isn't in the mainstream as far as casual or moderate web developers go.
And I really don't understand why the cost is so high since everything Java hosting uses is supposed to be free (compared to buying IIS & a windows server).
Re:I am completely unbiased... (Score:5, Interesting)
Does definitely remind me of VB, though the syntax isn't as screwy.
Re:J2EE won't fail... (Score:3, Interesting)
This is exactly contrary to my experience. Java *sucks* at playing nice with other systems, unless you build up a "play nice with Java" layer in those other systems first. PHP, shitty as it is, is much better. Python and Perl are both much better (Python more than perl these days, imo) as glue code.
Java works best when it can run in long running, memory hogging, monolithic processes, where it's development and execution model can really shine (these are the circumstances you get those "faster than C" benchmarks). Java doesn't play nice with other systems, and interop via JNI can kill the GC optimizations that let it beat manual memory management for performance.
Re:PHP is great stuff (Score:3, Interesting)
AFAIK:
Re:Pardon me while I unroll your eyes (Score:2, Interesting)
Coldfusion Gets no Love (Score:1, Interesting)
Ohh but you got to pay for it so that may be the problem.
Ok now you can continue and if anybody wants that can throw in the old "Coldfusion is not a real language."
What about the long run? (Score:5, Interesting)
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.
Re:I am completely unbiased... (Score:5, 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 [sourceforge.net] is a client side Java app. For those of you keeping score at home, the #2 spot, GAIM [sourceforge.net], is in C and PHP comes in at #3 via phpMyAdmin [sourceforge.net]. Keep in mind this is looking at quality (and a pretty wierd messure of quality, at that), not quantity, but still intersting.