Reply to Re: PHP compared to Java/J2EE

Your name:

Reply:


Posted by Wojtek on 11/14/07 17:55

flarosa wrote :
> Hi,
>
> I'm wondering if I can get a reasonably civil (without starting any
> huge wars) opinion on how server-side PHP compares to server-side
> Java.
>
> I've been strictly a Java developer for almost 10 years now, and I'm
> pretty happy with it. However, I can't help but notice that there are
> a significant amount of PHP-based development projects where I live,
> and I've also noticed when searching around the internet for ready-
> made web applications that a lot of them are in PHP.
>
> As an object-oriented programmer I've always assumed PHP was more of a
> scripting language for doing things on individual web pages or writing
> small applications and that Java/J2EE was better positioned for
> writing large applications, but maybe that's no longer true.

I have done work in both

PHP
- scripting language. The source code gets read and interpreted every
time a page hit occurs, unless you are using a precompiler, but then
the host server must have a special Apache extension to run it.
- becuase of the above it is expensive to use a lot of constants, so
you end up with a lot of magic numbers
- sort of OO. It has classes, but the implementation is not complete.
It was bolted on after the fact, so you can mix OO with procedural.
- one of the big features is the ability to "include" (or "requires") a
file. That way you build up a web page from many smaller files.
However, any variable which an included file might use from the parent
file, must be created by the parent file. So you may include a file
which requires a variable, only to have it crash becasue that variable
is not present. Makes debugging difficult.
- by design, presentation code is mixed with business logic
- great for small projects

Java
- compiled language. The compiler produces byte-code. The server reads
the byte code and uses the Java Runtime Environment (JRE) to run it.
- All constants are resolved by the compiler, so using many constants
makes the code more readable.
- The JRE will inspect the code execution path and will optimize it on
the fly. So the longer your code runs, the faster it runs.
- Is OO by design
- great for large projects.

So for small simple projects I use PHP. For anything serious I use
Java.

$0.02

--
Wojtek :-)

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация