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"
About 22 million Web sites employ it
Well, of course. PHP works for free.
Wondering where the '22 million web sites' comes from? http://www.php.net/usage.php.
This slashdot-related signature is a stub. You can help kihjin by expanding it.
Everything you need to know is in this article
Netscape always controlled the media when it came to the story about how the browser was first built. This is the only article that I've ever seen that actually went back to the place where it was created to find out the real story.
History is written by the victors.... Even if that "history" isn't true.
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
Two things:
Click here or here.
You can separate presentation and logic in PHP just fine, and once you come to doing templates you can use a really powerful templating language - PHP.
Little "full disclosure" for everyone.
PS There's more to Java on webservers than J2EE. There's also multiple Open Source versions of J2EE.
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.
Click here or here.
I'll stick with embedded perl, thanks. It does what I need, and I am already familiar with it. All the benefits of perl and mod_perl, with the simplicity of embedding into a page. I'm sure PHP is nice, but why bother learning it?
The alternative to extremely bloated and redundant java and .net web technologies is an extremely basic (old)ASP-alike with all functions and variables sharing the same namespace and global variables running wild. Granted, it's easy. Just as easy as notepad and just as featureless and error-prone...
.net as everybody else, but i'd point to Python, Ruby, Perl or Tcl technologies rather than this sub-Perl refugee...
Hey, i'm just as annoyed at java and
I don't feel like it...
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
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
I find it strange how people recommend Smarty for separation of code from content. Smarty implements its own while loops and if then statements. I have yet to come across a web application using Smarty that was easily readable. I would think if the goal was to separate code from content, one would use a templating engine more akin to QuickTemplates. It does not make you relearn a whole new programming language syntax for while loops and if then statements like Smarty does.
Separation of concerns (code in your presentation layer) is a design issue, not a language issue. Calling PHP a bad language because you can put code in your presentation layer is like calling water bad because you can drown in it.
"Times have not become more violent. They have just become more televised."
-Marilyn Manson
That's called a theory. It's much harder to build in reality, and mostly sucks anyway since you still don't get any namespace and have to decorate every damn function like there was no god.
Thing is in Java you can write your extensions in Java (the JIT compiler is running behind so perfs are good anyway), or use JNI to use C/C++ compiled modules.
Or you can do it the Nice Way and just hop on to Python or Ruby, get full OO, namespaces, and modules (including native compiled) that are actually fairly easy to build.
With batteries included
"The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
Sites that suffer the /. effect do so because they are not expecting the traffic. In the same way that very large enterprise websites that suddenly release XYZ bit of software for download by the marketing department who never told the IT department also suffer a similar /. effect. It isn't always the language or the programmer or the scaleability of the website. It all depends on what level of traffic is expected.
You find php's pdflib inadequate for your needs?
Why yes, yes I do. In Java I can use PDFBox to merge pages together, populate form fields, and literally tear apart and put the PDF back together. Manually. By object. With encryption.
Combined with the power of FOP (FO -> PDF) and SVG, PDFLib doesn't hold a bloody candle.
PHP may have a bunch of issues, but it's still the best tool for my job.
You mean like PHP-GTK?
I know this is about PHP but as a long-time web developer, I'm sure a lot of other web devs will be reading this, so here are my observations on RoR.
.NET and PHP. Here are some thoughts.
;)
.NET. I suppose this falls under the "Nobody ever got fired for recommending IBM" paradigm, but the si
I've started my first small-scale Ruby on Rails project, having done work in the past in ASP,
1) RoR may be highly buzz-worthy but it is certainly NOT a panacea. It has a definite and slightly steep learning curve, especially if you are also new to Ruby and/or OOP and/or MVC (I am sort of but not completely new to all of these). You will still have to do the work of developing your application- you just won't have to do the "stupid" kind of work that much (repeating code in views, bubbling new database fields through umpteen app tiers to the surface of your app, hand-validating everything, building a mechanism to bubble errors or notifications to the surface, etc. etc.)
That said...
2) I can see that if I can get past the little syntactic things that are currently tripping me up, a lot of the RoR technology (and all the assistance its framework provides, once you get to know it... again, that takes time) helps to make web development a breeze.
3) MVC certainly seems like a pattern to seriously consider for anything other than a small web app. Mixing code in the presentation layer is not the way to go if you want easy unit testing, separation of view from code (so your graphic designers can go in and do their thing separately), arbitrary mixing of controller code with different views, etc.
4) Ruby itself is a pretty great language to code in and highly readable. It has a few quirks (doesn't every language?) but if you are aware of them then they won't get in your way. Some of the things I like about it were apparently "borrowed" from Perl (as I never really got that into Perl). If you are not a static-typing purist, I'd say check it out on its own.
5) Installing some Ruby/Rails components that depend on each other is not at ALL as painless as it should be on OS X. For example, I'm currently having issues with RMagick and GraphicsMagick even though I followed a guide I found online, to the letter. I think the darwinports, fink, and rubygems people should get together and work some shit out, as all the different default paths these packaging/deployment tools install their stuff to causes mutual interdependencies to sometimes fail. I've also seen some MySQL issues that will require good troubleshooting to resolve, for some people- some of it is based on incompatibilities with GCC 4.0, or between the password hashes of different MySQL versions, or... Basically, this is all stuff that as a Rails scripter (as opposed to a C++ programmer) you wouldn't want to focus too much time on. If you want to know what I'm talking about just google "rmagick 'os x'" or "mysql rails 'os x'" and read up. That said, if you can get a good host with good Ruby/Rails support, you might not need to worry about such things... Unless you want to develop locally on that shiny Powerbook (grrrr). You better be a good troubleshooter, as Google won't get you out of EVERY bind!
6) The people on the #rubyonrails IRC channel on freenode are generally helpful, but not at all hours of the day. It also helps if you put up small PayPal rewards to get someone to help you over those time-sensitive humps
7) Managers at big corporations (such as my employer) who have been out of direct touch with technology for a while will only tend to recommend the "usual big stuff"- in this case Java/EJB/Oracle, or
Ok, I've been developing for 12 years now, and almost purely web development for the last 4. I generally use PHP for what its good for (page generation, presentation layer type stuff), and use xml-rpc or SOAP from php to connect to java, python, perl, or c++ whatever has the best libraries/capabilities/ease of use for what I'm trying to do. I've actually moved almost exclusively to python as my backend/business logic language of choice, but Java worked fine for this purpose 3 years ago too. To me, setting up struts, jsps, all that garbage is a ton of overhead that a simple soap/xml-rpc setup easily replaces (and in my experience php + soap/xml-rpc + languageX is faster than an all java setup). PHP then can do what its best at, my frontends are very lightweight, and load almost as fast as static html, and I use a real language for logic and libraries etc. Now maybe this new PHP Framework will provide some classes and things that would be useable on the backend, I dunno.
The setup I use is basically the J2EE model, except I get the best of all worlds, because I can access code written in any language seemlessly, use n-tier architecture without even thinking about it, use advanced cacheing libraries available in the higher end/heavier languages, and because the backend code is running as a daemon running a soap or xml-rpc server, I sidestep the whole perl/python interpretter startup bottleneck.
It's not about which language is "best" its about what tool gets the job done.
PHP-based applications can be great if designed by good programmers.
For proof, just look at some of the projects using PHP: Mantis Bug Tracker, PHPMyAdmin, MediaWiki (Wikipedia), several top discussion boards, Friendster, reportedly apps by Yahoo, and countless others.
These are HIGH-QUALITY web applications. Of course, great things can be done with other platforms, but it's nonsense to slam PHP because "it's so easy that non-programmers produce a lot of crap code with it". The proof that it's worthy is in the *best* apps that are produced, not the worst ones!
Steve Magruder, Metro Foodist
Not a big fan of Java, slow,
No, especially not server side. Reaches within a few % of C++ speed in well-established benchmarks:
http://www.shudo.net/jit/perf/
bulky,
No. It can run within a few 100k on mobile devices. Non-GUI java apps can run in just a few MB.
not user friendly.
A vague term, which could mean anything.
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..
I believe PHP accelerators (like the open source eAccelerator) do exactly that. But again, I am not a PHP expert.
Virus infects both Windows and Linux!