

Ask HN: Why PHP over Java? - manasnutcase

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
======
Rust
I am both a PHP and Java dev, and have found that PHP is far faster, leaner
and more maintainable for websites than Java is.

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.

~~~
Rust
It should be noted that the Java dev obviously over-designed the system, and
that a different dev may have delivered something much more "keepable".

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.

------
kls
That is the thing, PHP has a whole lot more projects that require a small
amount of tweaking and customizing to get a small business up and running.
Where Java has far more middleware and integration libraries for developers
that are building custom systems. We do both at our company and I would say
this, if you are doing something custom you will be much happier with Java, it
will take longer to get to market but that is where Java shines, in custom
business apps. If you are just doing a ecommerce site or a simple website then
get Magento or Wordpress and use PHP, What we tend to do for small clients
that we think will become big clients is that we back their front end
technology like Wordpress with and ESB like Mule and do any custom logic in
Java behind mule. This way the get the benefits of both.

------
burgerbrain
I'm not sure I would describe _either_ PHP or Java as for "hard core"
programmers.

As 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.

~~~
codenerdz
.."Enterprise" you should probably be aware is generally not considered to be
praise... Why? I can name a lot of products which I use daily which are
developed in an "enterprise" fashion

