I used both PHP and Java for server-side development, and although my
clients mostly ask for PHP (this is due to the strange PHP loving of
hosting providers here), I far more prefer Java. Just few points
why:

Language features
# PHP
  - no strict typing
  - horror of automatic type conversions (by the way it also increases
    vulnerability; PHP is the only language where "5 apples" * "3 astronauts"
    results in 15 :))
  - limited OOP

# Java
  + strict typing
  + full OOP
  + generics
  - a little bit defective generics
  - lack of properties

Technologies and APIs
# PHP
  - lack of a well-structured and designed standard class library
  - no standard APIs (PHP's "builtin" APIs are no more than an
    unorganized stack of functions, which use different aspects,
    follow different conventions, etc.)
  - no standard database access layer
  - no standard templating system (for web development)
  - limited implementations of standard technologies (XML, SOAP, etc.)
  + some efforts to create a standard library (PEAR), but it is still
    seems to be a "random" collection of unrelated packages
  - new versions (including even subversions) are often incompatible with
    previuos ones, which causes a bunch of extra work for updating
    older applications

# Java
  + huge class library
  + standard database access layer (JDBC)
  + standard and effective templating system (JSP, JSF)
  + well-designed and powerful third-party technologies (Hibernate,
    Struts, etc.)
  + new versions are compatible with previous ones

Maintenance & others
# PHP
  + multiplatform
  + almost doesn't require expertise (read 1-2 tutorials and setup
    your own server)
  - applications are distributed as source files by default (there are
    commercial bytecode compilers)
  + cheap hosting and there is a huge number of service providers (if
    you do not want to have your own server)


# Java
  + multiplatform
  - requires more knowledge and experience
  - requires relatively stronger hardware
  + applications are distributed in compiled (bytecode) form (but
    there are decompilers of course)
  - relatively more expensive hosting, often with limited access (Java
    applications - especially bigger ones - perform best if they are
    hosted on your own server, which of course increases expenses)

In general both PHP and Java are suitable for developing relatively
small applications, but as the size of the application increases the
PHP code requires more and more attention and work to keep it
well-structured, easy to maintain, etc., while Java's advanteges
become more and more clear. If somebody is a well-trained, skilled and
experienced developer, he/she can develop huge and well-organized
applications in PHP, too, but it is a lot easier in Java. In PHP you
have to create and write a lot of things from scratch, and the lack of
some useful language features (especially type checking) requires a
lot of care and additional work. Although the developers of PHP work
hard to make it better, it still suffers from the fact, that
originally it was created for far simpler purposes than it's todays
usage, while Java was targeted for creating big (and also small)
applications from the very beginnings.

And one more subjective aspect: I know people who migrated to Java
(or .NET, which is very similar) from PHP, but I don't know anyone
who dropped Java (or .NET) in favour of PHP.

PHP is very wide-spread technology, but it doesn't mean that it is the
best one. I can agree that most of the dynamic sites on the internet
have PHP as their back-end (I have no statistics, but think it's
around 80-90%), but the profit produced by these sites is no more than
5% of the total and the remaining 10-20% of Java, .NET, etc. based
sites produce the other 95%. IMHO of course :)

  Attila

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
From:    Weldon MacDonald <[EMAIL PROTECTED]>
To:      Flashcoders mailing list <flashcoders@chattyfig.figleaf.com>
Date:    Thursday, July 19, 2007, 6:01:13 PM
Subject: [Flashcoders] Backend compiled Java or scripted PHP?
--====----====----====----====----====----====----====----====----====----===--
I've been using ActionScript for a while now, but my next project will
require a lot more server side work. In the past I've used PHP, but
only in a pidgin kind of way. alternatively, I have some Java skills,
though not specifically for the web. Either way I have to spend some
time developing an appropriate skill level, the question becomes,
which skills.

The times I've used PHP, it seemed straight forward enough, and from
what I've read Java is a little trickier to implement on the web
(correct?). On the other hand, PHP is a pretty specific niche whereas
Java has a much wider usefulness (correct?)

There are a lot of strong opinions out there.

Andreessen: PHP succeeding where Java isn't
http://news.com.com/2100-1012-5903187.html?tag=tb

and  in response,

How they can compare PHP with Java at all? (most people who are
praising PHP are either bad programmers or they are not programmers at
all)
http://news.com.com/5208-1012_3-0.html?forumID=1&threadID=10712&messageID=78718&start=0

PHP is faster to develop, java is faster to run, or is that runs faster?
PHP is harder to maintain, and Java has more tools ...etc...

What's a guy to beloieve? Any opin... any more opinions?
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to