PERL vs. PHP vs. Java Servlet vs. ASP.NET

Could somebody pls give me a general comparison between these four server-side scripting tools in terms of:

  • performance
  • ease of programming
  • interface with back-end database
  • server operating system requirement

I am also interested in how web developers nowadays dynamically generate webpage content based on query results from the database back-end. How easy is it to do so? What mechanisms are there to use for this purpose?

Thanks a lot!! =)

these days? wow you must be one of those cobalt programmers. i’ll give you a short and simple explanation: java can do anything you can imagine but has a big resource footprint. PHP is amazing is fast effective and the language i would pick i never used and never will since it’s not open source.

This thread is going to turn into a “My Perl could kick your PHP’s butt!” discussion for sure. Each language has its own pros and cons, but every single person here is going to be biased toward one language or another.

Syntax-wise, none are really that hard to pick up. It’s more a matter of what your server supports. Perl is ubiquitous – it’s on almost every server you’ll find. PHP also has pretty good coverage. ASP is usually only found on Windows boxes, and you’ll have the hardest time finding a server with JSP support.

So, you can see that there’s no easy answer here. And really, it comes down to the programmer as to whether or not the code is optimized. I could write slow code in any language you want. :wink:

Database integration? It’s probably easiest with PHP/MySQL, but it can be done without too much pain in Perl, ASP, or JSP, as well. It’s up to you!

.Net with C# rules! :tup: Just my opinion, though. :blush: :wink:

Well here’s a code example in PHP, it’s really quite simple :slight_smile:

$db = mysql_connect('localhost', 'user', 'pass');

$sql = "SELECT field1, field2
	FROM table" ;
$rs = mysql_query($sql);

while ( $row = mysql_fetch_array($rs) ) {
	echo "
	<h1>{$row['field1']}</h1><br />\

	<p>{$row['field2']}</p><br />\


an older article, but still quite valid:

Admittedly, ASP.Net has a higher learning curve than PHP and Perl… Java has an even higher learning curve. :slight_smile:

I wouldn’t know coz haven’t exactly got dirty with any server-side language. However, on my list for learning is PHP, ASP.Net and XML for Flash. :smiley:

This is also another article which is worth a read although sole PHPians would say otherwise. Here’s the article:

Perl probably has the hardest syntax of the four to learn. If you’ve ever programmed in c or c++ you’d like PHP alot and it’s open source/free as opposed to PHP has quite a nice API for mysql, it’s really easy to query the DB and generate dynamic webpages.

PHP is probably the easiest language to learn, but you need to tell us what you plan to do and what experience you have. Once we understand what you need we can make better recommendations

Sean :slight_smile:

ASP.NET and PHP are better then PERL and JAVA for web dev. Nuff said.

If your hosting is Linux use PHP.
If you hosting is NT use (C#).

Have you ever actually programmed in JSP?

so my experience is as follows:

  • I am not planning to use JSP (Java Server Pages, according to my understanding). I just want to program with Java Servlet.

  • My webpage will have a portal. So users can have their own webspace on the server. All the info will be stored in a back-end database. A layer of logic written in Java will be responsible for taking in users’ requests, creating objects, and then modifying the database accordingly.

  • Could somebody advise me why PHP is better than Java? I have looked at the syntax of PHP before and it doesn’t look very pleasing to me (sorry if I offend anybody :), compared to the elegant Object-oriented layout of Java. Is it performance, ease of programming, ease to find a server that deploys PHP, or low price, or some other reason that gives PHP the upper-hand, according to you guys?

  • Also, if I do stick with Java Servlet, is there an easy way to dynamically generate webpages based on queries from a back-end database? DJ P@CkMaN kindly gave an example of how to dynamically generate webpages based on a back-end database. For simple webpages, that certainly works. But for a website as complex as, say, sitepoint, writing Html responses line by line seems not very scalable. Does anyone have any suggestion on how to deal with this issue?

Thanks so much!!

Something like SitePoint would be prety easy to do in PHP (ie. SitePoint, not SitePointForums). You don’t write HTML responses “line by line”, but I’m not going to get into heavy technicals here, esspecially as I don’t have enough knowledge to do so :stuck_out_tongue:

It depends on what you’r trying to do. A website (inc. portal) with a userbase, articlebase and DB backend is something PHP is very good at. Heavy server operations is something PHP can do, but isn’t real crash hot at.

Your logic layer sounds like PHP could do it pretty easily, I don’t know the specifics of how you’d designate webspace to users so I can’t comment on how PHP would do there but I’d imagine it could handle the task.

I was under the - obviously false - impression that JSP == Java Servlet but hey, we all learn something new everyday :wink:

IMO your best bet would be to learn PHP, Database design and analysis and then once you’ve learned about program development move onto Java.

.NET is not a requirement today and IMO an absolute waste of time :smiley:

Sorry, Doctor. .Net rules. :wink:

JSP and .NET are both good and each have their uses. For example, let’s say I start a new job with a company and they are building a brand new site from scratch, but they want it to run on their existing architecture. If the company is almost all Windows-based (i.e. using Exchange, SQL Server, etc. etc.) I’m most definitely writing their app in .NET, since it’s the obvious choice when dealing with an all-MS infrastructure. However, if their infrastructure consists of a bunch of old IBM AS/400s with legacy apps and data, some Sun machines running Oracle, some Linux boxes running Postfix for their mail servers, and a mix of OSX and Windows 2000 clients, and they need to integrate everything into their site/application, I’d go with JSP because it serves as a very good “glue” language/setup. If the company had little infrastructure to speak of and just needed a simple site yesterday I’d probably build it using classic ASP or PHP, since I can hack something up in those languages very quickly and don’t need to use OO design on something so small-scale. Every language has their uses and there’s a time/place for all of them. Fanboyism over a language does you no good, especially in a career as fast-paced and ever-changing as Web development. What you use today may not be around in 5 years.

Amen, brotha! Preach, preacha, preach!

It seems that everybody’s been talking about ASP.NET or PHP but nobody has talked in-depth about Java Servlet technology at all. Is there anyone that knows much about Java at all in this community? If so, please toss in your two cents. Thanks!!

Part of my job involves JSP/Java work, and my comment is a few posts up :D.