Ask HN: Why PHP over Java?
Hi,
Why are most Webapps developed in PHP while enterprise apps use Java?
I am asking this because I want to build a team for our next web app. We were recruiting PHP guys but I realize that most PHP guys have only done work on customizing OSCommerce, Wordpress, Drupal or Joomla, etc.. no hard core programming. Java people seem to be more "hard core" programmers.
Can you tell me why I shouldnt use Java? Thanks
5 comments
[ 3.1 ms ] story [ 26.0 ms ] threadAs far as I am concerned PHP is used by self-taught teenagers in the early 00's, while Java is as you mention popular in "enterprise".
"Enterprise" you should probably be aware is generally not considered to be praise.
The last hard-core (ie. expensive) Java dev we had working on one of our back-end projects turned in code that was so abstracted and made such heavy use of dependency injection, it was not only difficult to read through, but took over 30ms to respond to requests. Maintainability was a nightmare, mainly because by abstracting things so thoroughly he effectively (and inadvertently) made the platform so tightly coupled that changing low-level code became very difficult.
Our current hard-core (ie. affordable) PHP dev spent almost exactly the same number of hours re-implementing the Java system, retained the extensibility requirements, and the framework returns responses in about 1ms. We have extendable objects for everything (models, controller, extensions, etc.), but without the 5 to 10 layers of abstraction.
As an added benefit, with PHP we don't have to worry about recompiling every time a change is made (during development, at least), we aren't running any memory-hog VMs, and it's far easier to find good devs when we need them.
That said, PHP takes a lot of crap because of its low barriers to entry. It's easy to learn the basics, it's very easy to learn bad habits, and it's too easy to write insecure code. A good PHP dev knows how to write fast, secure code, but it is hard to figure out who is a "good" PHP dev and who is a "copy/paste" PHP dev.
However, my experience over the last 20 years has shown me that this is pretty much the way of things - expert Java devs love making things complex by layering more complexity over things in order to make them simpler. Expert PHP devs tend to remove complexity and turn in far more intelligently organized code.
I've seen exceptions to both generalizations, but not very damn many. It's depressing.