|
Posted by Steve on 11/14/07 18:17
"Wojtek" <nowhere@a.com> wrote in message
news:mn.72547d7b5e7805eb.70216@a.com...
> 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.
not true at all! php can run all by itself or as a module to most *any* web
server (if that is how you intend it to be executed).
> - becuase of the above it is expensive to use a lot of constants, so you
> end up with a lot of magic numbers
'because of the above' being FALSE, your point of expense is moot. not to
mention silly, even if what you'd claimed were true. last time i checked,
apache was still free.
as for 'magic numbers'? well hell, that's completely unrelated to the point
you were trying to make. second, *people* create magic numbers...not
programming languages. you may need to explain yourself a bit more here.
> - sort of OO. It has classes, but the implementation is not complete.
in what way?
> It was bolted on after the fact, so you can mix OO with procedural.
in *ANY* language, you can mix OO and proc code. as for being bolted on
after the fact, again that's a completely FALSE statement. aspects of OO
have been in php since at least php 3.0 and remained largely unchanged until
php 5. the major provisions of what is prized about OO were *all* there at
that time...that was back in early 1998 fwir!
> - 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.
ok...but again you assume php just does web pages. you do that with perl
too? or ruby? or java?
> 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.
well, that's a stupid argument. that goes to developer architecture,
implementation, and lack of error checking to prevent 'crashing'. it has
little to do with being a php weakness.
> - by design, presentation code is mixed with business logic
ONLY BY THE DESIGNER !!!
> - great for small projects
AND FOR THE MULTI-BILLION DOLLAR projects for the fortune 100 companies for
whom i've developed php applications. lots of data, lots of users, lots of
hits, lots of bad consequences if php (or my implementation of it) fails.
> Java
> - compiled language. The compiler produces byte-code.
not a fully compiled language. just like msil that is executed by the .net
framework, java need jre. not much of a greater advantage there.
> The server reads the byte code and uses the Java Runtime Environment (JRE)
> to run it.
see above.
> - All constants are resolved by the compiler, so using many constants
> makes the code more readable.
NO DIFFERENT THAN PHP.
> - The JRE will inspect the code execution path and will optimize it on the
> fly.
NO DIFFERENT THAN PHP. you need to quantify and qualify 'optimize'.
> So the longer your code runs, the faster it runs.
that is UTTERLY FALSE! there is a thing called an optimal limit. java will
hit a primary, ultimate, optimzed execution plan at some point. however, it
evaluates what 'optimal' is EVERY SINGLE TIME that code portion is going to
be executed.
as far as web development goes, php and java only get ONE pass at doing an
optimization. i think your point here is coming up a little short.
> - Is OO by design
nothing *IS OO*...java was written with OO support in mind from its onset.
though php put it in its tertiary release, it was done in short order. the
only argument to be made here is what of OO is supported by either AND of
the things NOT supported YET by php, which are NEEDED to get the job done.
> - great for large projects.
just like php. moot point.
> So for small simple projects I use PHP. For anything serious I use Java.
>
> $0.02
yeah, i think you're charging to much. i'd rate your overview about...one
peso, if that.
Navigation:
[Reply to this message]
|