[UPHPU] Java and Frameworks (was: MVC)

David Smith DavidSmith at byu.net
Thu Nov 11 10:09:17 MST 2004


<quote who="John David Anderson">
> From all I can tell (and I'm no big PHP or Java guru), but PHP is just
> as good as Java. I personally like PHP because its more flexible and
> way less verbose. System.out.println.righthere.astext.please("hello")
> vs. echo "Hi." :o)

PHP and Java Servlets are fundamentally different from eachother by
design. There is one big factor: persistent objects. In a Servlet, when
you create an instance of a class, it can remain in memory to be reused by
subsequent HTTP requests. In PHP, such instances must be serialized and
persisted to a session (typically written to a file, relational DB, or a
ramdisk). This design makes Servlets able to handle *huge* volumes of
users concurrently because objects don't have to be deserialized and
re-created to be reused. They just "stick around" in memory. This is why
Java excels in the enterprise web arena. That, and it has a huge marketing
department and much more "official" support.

Not to mention, when you talk about Enterprise Java (J2EE), you aren't
just talking about web applications and JSP, you're also taking about
transaction support. And PHP certainly does not have that. How can you
write a PHP transaction that credits a credit card, modifies an inventory
record, updates an internal accounting system, and emails notification,
all as one atomic unit. That is not easy in PHP. It's not easy in Java
either, but it's at least supported.

--Dave



More information about the UPHPU mailing list