Sunday, July 22, 2007

J2EE vs ASP.NET vs PHP

In this article, I wanted to compare the web application development platforms which I have been using for recent years. My comparison has no aim to make one platform better than others, or vice versa. These are all my own thoughts and what I have experienced during the development of web applications using the three platforms. It is open to you to express your opinions and stands as a comment.
Scores mean
10 – Best.
9 – Very Good.
8 – Good.


Syntax

I love Java syntax, a real object oriented syntax. PHP have some odd characters like “->, ::” and function calls are made directly like “substr, strreplace” which makes me feel like using procedural language. For ASP.NET, I have been using VB.NET.

J2EE: 10, ASP.NET: 9, PHP: 8

Easy to Learn
Believe or not, I learned PHP in two weeks. One day I decided to learn PHP and visited PHP official website. The website had one question explaining what is PHP and how and where to start. Manuals, documentation and samples were all there and ready to download. To prepare development environment was straight easy. ASP.NET was also easy to learn but bit difficult than PHP. J2EE was the most difficult and long process for me.

J2EE: 8, ASP.NET: 9, PHP: 10

Development Speed
For simple, small-size and CRUD applications, ASP.NET is the fastest one because of the pre-implemented controls, components and APIs. In PHP, if you use the right framework, it is also fast process.

J2EE: 8, ASP.NET: 10, PHP: 9

Platform
Although PHP works best on LAMP (Linux, Apache, MySQL and PHP) environment, you can deploy PHP web applications on other platforms such as Windows, Solaris etc…
ASP.NET have only one choice; Windows. There is a Mono tool for development and deployment of ASP.NET on Linux, but not ready for enterprise use. J2EE runs best everywhere.

J2EE: 10, ASP.NET: 8, PHP: 9

Database
Simplest theory is MySQL for PHP, Oracle for J2EE and MSSQL for ASP.NET. There are many other good databases out there. You can use most of them with all three languages by adding or installing appropriate drivers.

J2EE: 10 , ASP.NET: 10, PHP: 10

IDE – Integrated Development Environments
ASP.NET has only one choice, Visual Studio which is very cool IDE but costs puff ;) PHP have commercial and open source IDE-s. Most known PHP IDEs are Zend Studio and PHP Coder as far as I know. J2EE has nice open source choices as well as commercial. Eclipse is the most used and best IDE I have ever used. With its plug-in structure, you can use Eclipse almost for all purposes, even for PHP development. Beside Eclipse, there are some more good IDE-s like IntelliJ, Netbeans, Sun Studio etc…

J2EE: 10 , ASP.NET: 10, PHP: 9

OOP – Object Oriented Support
J2EE and ASP.NET win here. PHP have OOP support in its latest versions.

J2EE: 10, ASP.NET: 10, PHP: 9

AOP – Aspect Oriented Support
J2EE have some AOP frameworks one of which I have used. I don’t know whether ASP.NET and PHP supports AOP or not.

J2EE: 10 , ASP.NET: 9, PHP: 9

Security
J2EE is the most secure one I guess. Once, I had my PHP web application hacked by someone. So PHP is secure only when you code secure ;) For ASP.NET, people have some doubts because of previous versions of windows security holes and hells. I didn’t experience any security problem of ASP.NET till now.

J2EE: 10, ASP.NET: 9, PHP: 9

Performance
I liked PHP Performance. For web applications I have ever developed, the most satisfied application was written in PHP. J2EE was little bit heavier to start, and consumes huge system resources. I have not tested my ASP.NET applications against huge loads in real life. Till now, I didn’t have any complaint about performance of my ASP.NET applications.
J2EE: 9 , ASP.NET: 9, PHP: 10

Web Server
ASP.NET has only one choice; IIS. For PHP and J2EE, you have plenty of choices; commercial and open source. Apache is the most popular one for PHP. Sun AS, JBoss AS, Oracle AS, Weblogic, Tomcat, and some more are for J2EE. Most of the J2EE servers cost high.

J2EE: 10, ASP.NET: 9, PHP: 10

Libraries and Frameworks
All of three languages have third party libraries and frameworks. In PHP and J2EE, most of the frameworks and libraries are open source or free. In ASP.NET, most of the libraries and components out there are commercial.

J2EE: 10, ASP.NET: 9, PHP: 10

Support and Community
There are plenty of forums, mailing lists, user groups, communities, developers, blogs and websites for all of three platforms. Most of the ASP.NET support, documentation and forums are managed by Microsoft, while PHP support is given by developers itself. J2EE have both commercial and open source support groups.

J2EE: 10, ASP.NET: 10, PHP: 10

Cost
PHP have big advantage on cost, both TCO and Maintenance. You can have IDE, Web Server, Operating System and Database all for FREE ;)
For ASP.NET development, first you have to pay for Visual Studio, then for Windows Server and for MSSQL. I don’t how much it costs total because my company already paid for them. For J2EE, you have choices. As I mentioned before, there are commercial and open source tools and software available. It depends on you and your company whether to use commercial, supported alliances or not. For example, if you plan not to pay, you can use Eclipse as an IDE, Tomcat or JBoss as a server, MySQL as a database.

J2EE: 9, ASP.NET: 8, PHP: 10

Conclusion
These three platforms are the most popular platforms for web development (of course, here we should mention Ruby On Rails, Django and few more ;) and they all have some advantages and disadvantages against each others. You have to choose the right platform according to the project behavior, size and scope, but also the criteria I listed above. I will not sum the total scores which will be unfair since I didn’t list all the available features of the platforms.

Related Comparisons and Discussions

See Also;
  1. Most Useful 20+ Visual Studio Add-ins
  2. ASP.NET AJAX Resources, Samples, Articles, Tutorials
  3. What is Microsoft Silverlight? Silverlight Resources, Articles and Tutorials
  4. AJAX Frameworks and Resources
  5. SQL Injection Resources
  6. Prevent robots from submitting data
  7. Frameworks are more important than Programming Languages
  8. Programming Handbooks and Cheatsheets

38 comments:

Unknown said...

134 for J2EE, 129 for ASP .NET and 132 for PHP :D

bayarsaikhan said...

Good job Luke ;)
there are more criteria you know
it is only my lists. you can add your criterian.

Unknown said...

You should have developed with C#, not VB.NET. Much more like Java as syntax

bayarsaikhan said...

I have fight many times with Senior IT Consultant of our company to make our choice on C#, but he resist on VB.NET since his background was coming from Powerbuilder.

Anonymous said...

Wow, nice attempt to try, and push PHP as a web platform of choice!

I mean, are you smoking crack on PHP vs JEE performance!?!? What the heck does this have to do with performance: "I liked PHP Performance. For web applications I have ever developed, the most satisfied application was written in PHP."!? How can an application be 'satisfied'!? Did it come back later an thank you for a job well done with regard to it's performance or something?

And how about this: "Most of the J2EE servers cost high." You didn't even attempt to qualify what you were "reviewing" here. Are we talking about Java web apps that require a full JEE stack!? Well in that case, PHP has nothing that comes close in addressing the same category of problems so cost here will be irrelevant. In any case, look at Glassfish, Geronimo, JBoss before making nonsensical conclusions.

Cost, more idiotic drivel: "PHP have big advantage on cost, both TCO and Maintenance. You can have IDE, Web Server, Operating System and Database all for FREE ;)". Oh, I see, because Java doesn't? Phlease! What a load of crap, have you ever heard of Eclipse + Glassfish + [Insert your OS of choice here]!? How is that not free!? And yet, PHP gets a 10 in this category while JEE a nice, because: "For J2EE, you have choices."!!!

Seriously, read your own post next time you think of doing something like this!

Sheesh!

Anonymous said...

Visual Studio Express is FREE and is more than enough for small and even some mid sized web sites.

SharpDevelop is free, open source, IDE that can be used instead of VS.

Geronimo and Glassfish are FREE and full-stack enterprise Java servers. JBoss too.

Sorry to say, buy you, looks to me, are not well informed about technologies you comment in your text.

Anonymous said...

.Net should get a lower score on web servers, because the only real choice there is IIS.

Ali Hassan Al Lawati said...

also to add

doing complicated things on the site is much easier in JAVA and .NET and more complicated in php

php may be best for usuall sites

another nice comparison will be on how many good HOSTs are there for these platforms and how much each cost

bayarsaikhan said...

Thanks guys for your opinions and comments.

If you read the introductions, there was "My comparison has no aim to make one platform better than others, or vice versa. These are all my own thoughts and what I have experienced during the development of web applications using the three platforms. It is open to you to express your opinions and stands as a comment."

It is all my own thoughts and impressions after using these ones. Nothing odd here to blog my opinions about these platforms with someone. As you knows very well guys, these all three platforms are best ones around today, but all of them have some kind of advantages and disadvantages. All the stuff i listed here was cons and pros for ME.

I understand because someone should be advocate of his platforms he liked, or is using.

It is nice to know what you think of the platforms.

To Anonymous;
As Luke summarized the scores, J2EE have the highest score. I also mentioned about the Free and Open Source choices in J2EE. For PHP, my application was serving concurrent 500 readers who are reading newspapers, videos and listening to radios, and this application was running on regular server. If such application was developed by J2EE, again for me, we would need more powerful server machine to run it.

To Yoda;
I have tried Express, Sharpdevelop and Mono develop. But all of them have big limitations if you plan to do real, enterprise level applications. They are all ideal for someone who is learning or playing around. But I hope/wish these alternative IDEs will get more mature by time.
About the Geronimo and Glassfish, thanks for suggestions. JBoss - i mentioned.

To Anonymous;
.NET have already lower score than the other twos. Maybe 8? ;)

To Ali Hassan;
This kind of suggestions was exactly what i expected from readers.

Thanks guys again.

Anonymous said...

If ASP and PHP have no AOP, I'd have given them zeros or not included that point since it's unfair to compare something not all of them have.

On security, are you aware how many security holes have and continue to be found in the PHP interpreter itself? I'd have docked it a few points for that.

On performance, it's true that J2EE uses more resources for low traffic. However, if you get into heavy traffic (millions/billions of hits) it uses a lot less. For example, you can have N+1 with two J2EE servers that have 4 CPUs + 8 GB RAM or N+1 with 9 PHP servers that each have 2 CPUs + 2 GB RAM -- which looks more resource intensive to you? :)

Otherwise a pretty fair comparison.

bayarsaikhan said...

Thanks anon;

For me, none of the platforms deserve ZERO in any criteria.

Although PHP has security holes found many times, many popular sites and applications are running it secure when the coding is careful and secure.

On performance, I forgot to mention about J2EE is the best in huge applications such like Financial appliances, ERP/CRM systems, Banking system etc...

Dinh said...

Regarding to performance, PHP is better than J2EE and ASP.NET

http://www.oreillynet.com/onlamp/blog/2006/04/digg_phps_scalability_and_perf.html

PHP is more scalable than Java, said Tim, Sun Microsystem web technologies directory. http://blog.thinkphp.de/archives/170-Keynote-of-Tim-Bray-some-interesting-comparison-between-PHP,-Rails-and-Java.html

PHP does support Aspect Oriented Programming: http://phpaspect.org/

http://www.cs.toronto.edu/~yijun/aspectPHP/

http://www.aophp.net/

Regarding to IDE for PHP, Zend Studio is among popular one. Komodo, PHPEd, PHPEdit, PHP Designer, PHP Eclipse and Eclipse PDT... are some of full features IDEs actively developed out there. They are far better than Visual Studio + PHP Extension (VS.PHP) IDE.

You can run PHP on any Java application server you've got: http://blogs.sun.com/theaquarium/entry/php_in_glassfish

PHP imlementation in Java: http://weblogs.java.net/blog/robogeek/archive/2007/03/re_100_java_que.html

PHP run in Sun web server which is both free in development and deployment http://developers.sun.com/webserver/reference/techart/php.html

PHP with Java Single Sign-on: http://www.josso.org/php-apidocs/index.html

There are a lot of articles that show how to integrate PHP with Java seamlessly.

So, I love to develop applications with PHP and Java. ASP.NET with its big limitations is used only when my customers require me to hack into their legacy system.

Anonymous said...

"->" and "::" are weird? Check C++ :)

bayarsaikhan said...

To pcdinh; Nice to hear about AOP support in PHP. It is also available in ASP.NET but they are not well known around. IBM and Sun like server vendors support PHP and others, but it seems for me something like "Developing web using Delphi which is possible, but !"
You are right about PHP Editors and their availability, but when comparing Zend Studio to Eclipse and Visual Studio, scores may come pretty fair.

By the way, big big thanks for the nice resources, articles and links that you supplied.

To Kodie; Yes they are weird. C++ is also weird ;) HRESULT etc... Simple is good.

Anonymous said...

Congratulations, you're comparing two development frameworks (J2EE and ASP.NET) to a raw language (PHP). Wow, what a great and useful comparison.

Adding to the fact there are no numbers or anything to backup any of your "objective" claims, it just makes this comparison all the more useless.

Anonymous said...

cool comparison
i my self use the 3 languages too but i think that .net wins all
both php and java don't have good IDE like the vs.net
php is not OOP at all and it event have no namespaces to organize its functions
java peroformance is horrible compared to php and asp.net even on Linux
PHP is free but ur client will expect u r free too :D so pick ur client ;)

bayarsaikhan said...

"both php and java don't have good IDE like the vs.net"

Come oon. Eclipse is better than VS.NET

ラファエル said...

These are very different beasts.
J2EE is the highest of the highest, it's for massive problems, World Wide Problems. It has some great development tools, deployment applications and databases, all free, but you need people to program and run them, which is very costly and complicated.

Php is simplicity, like Ruby, python, and others aims for efficiency but not resilience, it's more fitted for small problems.

.Net is somewhere in between, using the entire microsoft platform, certainly gives you pretty good productivity, resilience and a great platform for developing, but it doesn't have the nearly the ammount of WMDs Java has, several for each problem, plus there's the Java penetration in gadgets that opens up some unique software design capabilities.

It's down to what kind of problem you're solving and what constraints you're working with.

bayarsaikhan said...

Thanks to Miranda,

Pretty fair summary of all that said.

Anonymous said...

Hi,

I liked the comparison

About the "Cost" headline, MySQL actually costs under commercial use...

Anonymous said...

X6rdj9 Your blog is great. Articles is interesting!

bLiTz said...

if you dont read the comments,, the article is pretty misleading. actually doesn't lead one anywhere

the conclusion must have been in terms of,, what to use and when,, what is better for what purpose for example
1. j2ee is the only choice for large applications that need to be secure while maintaining app.states
2. php is better for scalable application where data security is less of a concern like community blog site or for a small homepage which needs templates n stuff.
3. and finally .net is mostly a neccessity when your employers are bound to a ms platform. though i like its ease of use and spped of dev., i hate that the very things that i want to change, i cant.(not a problem for normal programmers but i like to customize a lot)

Unknown said...
This comment has been removed by the author.
Anonymous said...

First of all, thanks Bayar for this informative entry.

Then to Anonymous I say: Try to be more polite commenting other people's opinions, J2EE needed better than that!

Then comes my comment: technically speaking; all of the three platforms are: versatile, powerful, feature-rich, well supported, cutting-edge and recognized. The problem was and will always be the developer's skills. A well designed web application could be done just with some good skills, a cop of coffee and an Internet connection.

Cheers.

Anonymous said...

this seems to be good article

Anonymous said...

hello:
its my pleasure to read your blog.
i have more new information got on this;
To kodie.
Try to think how old c++ is.
and therefore you can conclude that you are the weird person not them:
jejejeje
Peace:

Anonymous said...

this post sucks. You like J2EE obviously.

bayarsaikhan said...

no i absolutely love and use PHP.
but i loved and used other twos as well ;)

Anonymous said...

Fairly impartial, albeit there is some information that you seemed unaware of.

ASP.NET can be Extended to do anything. Has the same cost model as php. You can run it on linux, unix, bsd or whatever framework you want.

ASP.NET (IIS and Framework) have only had 4 Security Issues identified since 1996. Thats saying alot considering.

You can use ASP.NET in conujunction with mySQL, SQL Express, Oracle or text files. Its not particularly partial to any db.

Windows is the default targeted provider (just as well as Microsoft is footing the bill for it.).

As for development ASP.NET you can program in:
VB
C#
C++
J#


Also, you can leverage asp.net to compile php applications using modules that for lack of better wording allow you to run php apps (phpBB3).

Additionally, you can program extensions to share session, context and data between all of them.

I do like php and asp.net equally I rate j2ee lower as a result of many failures of the product. However, I contend that it is a great product in the right hands and a bad one in a novices.

Anonymous said...

Good articles and good comments. Thank you for sharing. I have learned a lesson.

Anonymous said...

Some pretty mean comments and misleading information also (most of it has been bashed already so no point repeating again).

In my experience, people who hate Microsoft (a lot of them) prefer PHP and other stuff. People who feel secure with Microsoft go for ASP.net. It's community vs corporate mentality and it shows in product selection. I personally would evaluate the requirements for each task and use the appropriate technology/tool/resources to implement the project. Whether it's PHP, ASP.Net, J2EE etc. Think about how really big sites like facebook, MSDN, london stock exchange and many retail sites are built using PHP, ASP.Net, J2EE technologies. They all work and are usable by the normal public. I don't think the arguments would have changed if facebook was written in ASPX and MSDN in PHP, they would have done their jobs (serving web contents) perfectly.

An old proverb comes to my mind: A tool is only as good as the person using it (or something like it).

Think deep before commenting on anything because everything has it's merits and demerits and unless anyone has solid evidence (objective) to support their claims, the whole discussion is pointless!

Anonymous said...

I have learned ASP at university then I have changed to JSP. These two are quite similar in some ways. But I found ASP much easier and I lose less hair with ASP than with JSP. LOL!

Finally I have started my real world website. As you know, we have to host a site in a hosting company. And then I found most of the big and famous hosting companies provided PHP and other open source sever script. Even worst, the hosting companies themselves are using PHP for their own script. If you can visit Hostmoser.com, ixwebhosting.com, bravenet.com, you can find index.php or something with php extension. And then I said oh gosssh... what are they doing...? So I started looking for PHP books. Believe it or not, I read only 2 weeks before I started develop my site. And It works. It's not so hard; it is up and ready to run; most codes are built in, e.g. connecting to MySQL, reading XML. Everything is ready. And it really free. Finally I made my site run by using PHP. I have to give PHP more credits.

Anonymous said...

Hello ALL,

Is there any IDE like Visual Studio .net to develop J2EE-Applications. to Drag-n-Drop different types on controls on a page... please let me know.

zafarcs117@gmail.com

Thanks!!

Anonymous said...

did you know that apache has some modules for asp.net support?! :D

usually when you must create some project for client we can think what is better, if it is simple web page, maybe we can choose php and mysql (because all together is cheap :D ), but if project must works with clients old MSSQL database, we can choose asp, etc. anyway this all is good

paul said...

this article sounds good.. thanks for the information.

Anonymous said...

kooi

Anonymous said...

I think it was a fairly fair assessment. The guy who accused you of smoking crack... comes from a java background... I've seen it before.
My experience, which I've done all three, tells me PHP is much easier in web development. I would use j2ee if I was doing something really narly where you just can't in php or asp.
PHP is my choice for 99.9% of websites I do. It is quicker, easier to maintain, and alot less overhead.
cheers

Anonymous said...

Is this a joke??, no really... is this a joke ??... I have my own comparison and my results are : Pythom 2350, ASP.NET -150, J2EE : blue and PHP = PI