473,549 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PHP compared to Java/J2EE

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.

Let me know what you think. Thanks.

Frank

Nov 14 '07 #1
66 4631
On Nov 14, 2:35 pm, flarosa <fr...@franklar osa.comwrote:
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.

Let me know what you think. Thanks.

Frank
Frank,
I asked myself the same question some time ago. most of the answer i
found it at:

http://www.tbray.org/ongoing/When/20...ing-Frameworks
hope it helps

Nov 14 '07 #2
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 :-)
Nov 14 '07 #3
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.

Let me know what you think. Thanks.

Frank

Frank,

PHP is more popular because it's supported by all the web servers. When
PHP first came out, for instance, Apache and IIS didn't support Java
well on the server side (don't know what it's like now). Plus is is
fast and has a smaller memory footprint than Java, which made it better
for shared hosting companies. The result is that a lot of hosting
companies offered PHP really cheap - but Java support was comparatively
lacking and more expensive.

PHP is getting more object oriented. It still has a ways to go - Java
is much better in that respect. But PHP is getting there, a little at a
time.

Now when you're talking larger applications, I agree Java is a better
language, especially when you're talking GUIs. There is a GUI available
for PHP, but it is sadly lacking in functionality compared to Java. And
Java's event model makes some things much easier than in PHP (which
doesn't have an equivalent).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===

Nov 14 '07 #4
..oO(Wojtek)
>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.
There are also several PECL extension for PHP to cache the compiled
bytecode (PHP code is compiled first and then interpreted by the ZE).
One of these caches (APC) will most likely be part of PHP 6.
>- becuase of the above it is expensive to use a lot of constants, so
you end up with a lot of magic numbers
Huh? I use hundreds of global and class constants. This is definitely
not a performance hit, there are "better" ways to waste CPU time.
>- by design, presentation code is mixed with business logic
Such mixing is possible in other languages as well. And it's always the
developer who decides if he wants to make use of it or not. Of course
you can also properly separate business from presentation logic.
>- great for small projects
Also great for bigger projects. Of course like in all languages you have
to know what you're doing and know the tools you're using.

Micha
Nov 14 '07 #5
On Nov 14, 12:56 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
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.
Let me know what you think. Thanks.
Frank

Frank,

PHP is more popular because it's supported by all the web servers. When
PHP first came out, for instance, Apache and IIS didn't support Java
well on the server side (don't know what it's like now). Plus is is
fast and has a smaller memory footprint than Java, which made it better
for shared hosting companies. The result is that a lot of hosting
companies offered PHP really cheap - but Java support was comparatively
lacking and more expensive.

PHP is getting more object oriented. It still has a ways to go - Java
is much better in that respect. But PHP is getting there, a little at a
time.

Now when you're talking larger applications, I agree Java is a better
language, especially when you're talking GUIs. There is a GUI available
for PHP, but it is sadly lacking in functionality compared to Java. And
Java's event model makes some things much easier than in PHP (which
doesn't have an equivalent).

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===
This is an interesting discussion. I have used Java but never used it
for a web application. Can anyone point me to a good place to learn
how to use this? Is this using JSP and servlets or is this something
else?

I am starting work on a project and I was going to do it with PHP,
MySQL, and some AJAX stuff. I considered doing it in Java but my
timetable is pretty short and front end GUI stuff in Java is a
nightmare to me (not good at it, not bashing Java). So with my short
time frame, I figured that a web based application would be the best
way where I can quickly build the interface. My application is not
huge, probably 50-75 hours for me to do.

THanks.

Nov 14 '07 #6
Steve wrote :
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.
Expensive in terms of processor time, not currency.

--
Wojtek :-)
Nov 14 '07 #7

"Wojtek" <no*****@a.comw rote in message
news:mn******** *************** @a.com...
Steve wrote :
>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.

Expensive in terms of processor time, not currency.
yeah, i got that after i reviewed the post. :)

even still, when talking web dev, php has a supremely smaller footprint than
java coule ever hope to attain. what php does provide, it makes sure it
doesn't sacrifice speed. and, as i think i saw someone else post, you can
get php to a semi-compiled state just as java does.
Nov 14 '07 #8
Lew
Steve wrote:
not a fully compiled language. just like msil that is executed by the .net
framework, java [sic] need jre [sic]. not much of a greater advantage there.
Actually, Java JVMs are quite effective at runtime code optimizations.

"Wojtek" <no*****@a.comw rote in message
>The server reads the byte code and uses the Java Runtime Environment (JRE)
to run it.
...
>- The JRE will inspect the code execution path and will optimize it on the
fly.
Steve wrote:
NO DIFFERENT THAN [sic] PHP. you need to quantify and qualify 'optimize'.
Actually, it's quite different, for most JVMs. JVMs perform inlining, loop
unrolling, enregistering, escape analysis, common-code refactoring,
just-in-time adaptive compilation and various forms of run-time analysis that
static-compilation tools are hard-pressed to achieve. While it's certainly
possible to do these things with PHP, most interpreters don't.

The various optimizations in the JVM achieve at least a ten-fold increase over
strictly interpreted bytecode, according to articles I've read. I saw that
simply switching a major enterprise server at a job site from "-client" to
"-server" doubled its throughput.

If I may be so bold, resorting to /ad hominem/ remarks in your exposition
redounded to its detriment.

--
Lew
Nov 14 '07 #9
Steve wrote :
php and java only get ONE pass at doing an optimization.
Nope. Modern Java implementations use adaptive optimization during
runtime. With traditional compiled languages, the compiler does it
once.

http://en.wikipedia.org/wiki/Java_pe...e_optimization

--
Wojtek :-)
Nov 14 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4919
by: Sig | last post by:
Hi there, Could you help me finding out whether Zope could be a serious technological framework for big corporation (compared to J2EE and ..Net) or not ? In the (quite very) big corporation I work in, the IT managers are wondering about the future of web technologies for our intranets. Currently, we run web applications in many...
21
2578
by: asj | last post by:
well, at least for the forseeable future, it looks like. i've always thought mauricio aguilar was a loony for continuing to post these job stats, when we all know C#/.NET jobs HAVE to go up sometime and equalize as VB and other non-.NET microsoft tech jobs go down. also, search engines can frequently be misused, so i tend to go with guys...
2
3430
by: radhikarohatgi | last post by:
Currently, to fuel our growth we are actively looking for professionals in Java/J2EE technologies with 2-7 yrs of experience for our Noida Center of Excellence. I would like you to go through the Techspan synopsis, which will help you in assessing our organization. TechSpan India is now a part of Headstrong inc, Headstrong Corporation is...
1
2140
by: bijay | last post by:
Hi, For Java , J2EE UML Interview FAQ and Certification Resources Please try. http://javainterview.tripod.com AND http://java.schoolreference.com
0
1570
by: crystal | last post by:
Crystal Concepts offering PHP-MYSQL & JAVA/J2EE courses on short term basis. For details contact, 19/2 New No 182 Kaliamman Koil Street, Virugambakkam Chennai 600 092 mail: crystalcss@gmail.com Mobile: 98407-28150
0
1865
by: praveen2gupta | last post by:
Hi, Java Char Datatype supports unicode. The Unicode supports 650 Human Languages. I would like to know How to use This feature while developing the Java/J2EE/JSP web based software product.
1
1907
by: willimm | last post by:
I have a java/j2EE Position open in Westchester NY. Thought i would share this with you guys. Full time perm position hit me up willimm@gmail.com Mac
0
1901
by: Giri | last post by:
We also have PE, SSE, SSE QA, SE QA, SSE-SCM positions *Please send the resume to girish_mc@intuit.com* 1) PE - Minimum 9 years experience - Must have extensive C++ application development experience
2
7723
by: cppcompiler1000 | last post by:
sir, after c and c++ , i wanna do java and j2ee or .net . please tell me whether i should java/j2ee or .net for the job purpose. give me some conclusion and difference between these languages. which would be simple to learn and includes more job opportunities. is "appin technology" is the best company for learnning java/j2ee or .net. please...
0
7527
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7726
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
5377
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5097
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
772
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.