Hudzilla.org - the homepage of Paul Hudson
Contents > Introducing PHP > Advantages of PHP Wish List | Report Bug | About Me ]

2.2.5     Competing Languages

This is NOT the latest copy of this book; click here for the latest version.

Much to the chagrin of a large group of developers, PHP is not the only option available to web developers, and, although I really am leaving myself open to flame-mail here, PHP is not always the best option, either.

In order to make sure your PHP education is rounded, I want to introduce you briefly to the other web development languages on offer, how they compare to PHP, and, where appropriate, when a language is a better choice than PHP for a certain task.

2.2.5.1 Perl

Perl is the most popular of the PHP alternatives out there, arguably because it is also the oldest. There is a large installed base of Perl out there; many open-source projects require Perl to be installed to work properly. It has the advantages of being very (very!) flexible, and also having a large collection of modules already written for it. However, it is let down by the fact that it is very easy to write obfuscated and confusing Perl without really realising you are doing so, and this has resulted in such marvels as the annual Obfuscated Perl Contest.

Well-written Perl scripts often look fairly like their PHP equivalent. The major cause for Perl's messy appearance is that many Perl programmers rely on "one-liners" - packing large amounts of functionality into just one line of code. Perl was once described very accurately by its creator, Larry Wall, when he argued that the front cover for his O'Reilly book on Perl should be a camel, saying that Perl was ugly but serviceable, and able to go long distances without much nourishment.

Perl is often a better choice when you want to take advantage of some of the pre-written libraries. CPAN, Perl's library repository, is very big, and there is a huge range of code for you to take, customise, and re-use. Perl also has a very active - and very cool - hacker community around it that's a whole lot of fun to be part of and is really a bedrock of support when you need it. Larry Wall and Damian Conway (both core Perl developers) are both rightfully revered as "alpha geeks" - people who really push the envelope of programming by doing cool new things. They are both very friendly, and attend many conferences year round - go ahead and introduce yourself if you meet them, because they really are fascinating to talk to.

2.2.5.2 ASP

Active Server Pages (ASP) and ASP.NET is Microsoft's attempt to succeed in the web development market, and comes as standard with their web server, IIS. ASP has been mauled by the open source community ever since it came out, and they gave a variety of reasons: it is proprietary, single platform (Windows), and slow.

I would like to say, "Yes, yes, and yes", but I'm not going to try to pull the wool over your eyes. The reality is that ASP has been implemented on other platforms, and, when running on Windows and Microsoft Internet Information Services (IIS), is actually lightning-fast.

That coupled with the fact that you can write add-on modules for ASP using Visual Basic and COM would make the whole solution very attractive indeed if it were not for the fact that ASP only really works well on IIS. On other platforms there are many fewer features, and it generally runs a great deal slower. When running on Windows, the security issues and licensing costs tends to be the most important thing, particularly when an all-Microsoft solution stack is being used.

ASP/ASP.NET is generally favoured when an all-Microsoft stack is in place. When used on Windows, it is very easy to deploy .NET code to ASP.NET pages or even write your ASP pages using C#.

Author's Note: If you're migrating from ASP to PHP, you might consider using ASP2PHP, a freeware converter between the languages. Although it isn't perfect, it can give you a big head start if you are trying to migrate a large project. Your best option is to use the tool, then go over the generated scripts by hand to make sure there are no bugs or performance issues. You can download ASP2PHP from http://asp2php.naken.cc .

2.2.5.3 ColdFusion

ColdFusion used to be quite popular back in the hey-days of the dot.com boom because it is developed using a proprietary IDE designed for novice programmers who have no wish to see source code of any complexity.

For such a wizard-oriented system, ColdFusion performs fairly well. Performance is nothing to be desired, but development speed is good. Perhaps ColdFusion's biggest let-down is the price tag - you will certainly need to sit down before you see it. ColdFusion was bought out by Macromedia, and this has served to boost its corporate appeal in places where open-source is still frowned upon.

The main drawback to using ColdFusion is arguably its user-friendliness, which might sound odd at first, but let me clarify. With PHP and Perl, because the languages are so flexible, you have much more control over what happens and why. If something goes wrong in your code, it's normally very easy to track it down and solve the problem, or change your plans and implement a different solution to the same problem. Very often, stock ColdFusion has just one way to solve a problem, and this greatly reduces your control over the solution you make. However, at the very least, you can work using ColdFusion when you are in team with non-technical people.

The biggest advantage to ColdFusion is its IDE and the language it uses, "CFML" (ColdFusion Markup Language) - even junior programmers can learn the system and start making pages quickly. As a result, you will often find ColdFusion in use at very large companies where they use Visual Basic (another easy, but not very powerful or fast language) for offline work.

2.2.5.4 JSP

Java Servlet Pages has often been considered the "dark horse" in web scripting because at first many thought it would be overkill for the job and yet has managed to get quite a substantial community about it nonetheless. JSP has three key advantages over some of its competitors, which may be why it has done so well:

  1. It uses Java, a language that already has a large skill set of developers and a massive amount of functionality available. Java is also conducive to scalability as it distributes across multiple computers well.

  2. Sun, as well as other members of the community, has worked hard to promote the language and tools that support it, which means that JSP has a lot of backing inside larger enterprises.

  3. It strongly encourages templating of pages for maximum code re-use. Templates for PHP are widely available, but they are a great deal more popular in JSP.

It is a common argument that because JSP is based on Java it scales better than PHP. This is not correct per se in the same way that most other over-generalisations are not correct (yes, I realise that is an over-generalisation too, and hence you are free to enjoy the irony!) - PHP scales perfectly well as long as you write your PHP scripts using the same design patterns you would have used writing your JSPs.

JSP is a popular choice when existing back-end business logic is written in Java also, as this keeps the development team language-homogenous.





<< 2.2.4 Performance   2.2.6 When to use PHP >>
Table of Contents
Want to see this stuff in print? PHP in a Nutshell takes the core topics covered here, adds in thousands of edits from the editorial team and myself, and combines them to make an unbeatable reference for PHP programmers at all levels.



My latest book has hundreds more tips on how to use PHP, Apache, and MySQL, plus Perl, Python, shell scripts, performance tuning, and more!



Top-right shadow
 
Bottom-left shadow Bottom shadow

Comments from other readers
ColdFusion Developer - 29 Aug 2008

Coldfusion 8 has added an entirely new generation of tags and now that Adobe has purchased from Macromedia support for Flex and integration with other programming languages above are number. (.net, php, etc.)

In my opinion very powerful and should be considered against php and .net

Hey Myspace was written in Coldfusion.

TerraNode - 29 Aug 2008

ASP.Net is here wrongly considered as "Scripting Language" while it is not. It is a container composed of an XML Tagger, a Common Framework, a WebServer and A large variety of usable Programming Languages, it's the hole set, the unique solution when deployed on Windows Server.

PHP is well know as the fastest Scripting Language for Web publishing, but not as structured as .Net and J2EE JSPs, but supported by millions of users and especially Google, PHP is the best when we don't have heavy weight Business layer.

JSP/Servlet containers are aver popular, but are issued from the J2EE specifications, which leaves to vendors the choice of implementing their own Architectures, and this is a big constraint since the different vendors provide incompatible Containers.
Java is know as slow on windows, and we should consider the fact that Windows Server can host a PHP interpreter as well as its .Net container more efficiently than A JSP one.
Windows Server is widely present in all industries.

Pat - 29 Aug 2008

And I bet you are proud of this article… that’s scary.

A PHP User - 29 Aug 2008

There is a very clear lack of understanding by the author of all technologies that are listed... tag to ignore article

A PHP User - 29 Aug 2008

There is a very clear lack of understanding by the author of all technologies that are listed... tag to ignore article

A PHP User - 29 Aug 2008

There is a very clear lack of understanding by the author of all technologies that are listed... tag to ignore article

A PHP/ColdFusion User - 29 Aug 2008

PHP is easier to use and is more logical to program but, Coldfusion has easier syntax when dealing with a database.

PHP is harder to program when dealing with database functionalities and PHP lacks the tools that ASP.NET has for producing quick and easy web applications.

they all have their place but, each one has their own faults.

A Coldfusion Developer - 29 Aug 2008

Your information on Coldfusion is painfully false and out of date. Coldfusion, at least in my experience, is hand coded, not produced by an IDE and most Coldfusion developers are actual programmers.

Fundamentally, there is little difference in problem solving and logic in Coldfusion as in other languages and there is usually more than one way to go about solving a problem.

Saying that Coldfusion is mainly used by newbies in a wizard-based IDE is a gross misstatement and helps spread
false and negative rumors about the language.

A Coldfusion Developer - 29 Aug 2008

Your information on Coldfusion is painfully false and out of date. Coldfusion, at least in my experience, is hand coded, not produced by an IDE and most Coldfusion developers are actual programmers.

Fundamentally, there is little difference in problem solving and logic in Coldfusion as in other languages and there is usually more than one way to go about solving a problem.

Saying that Coldfusion is mainly used by newbies in a wizard-based IDE is a gross misstatement and helps spread
false and negative rumors about the language.

PHP Lover - 29 Aug 2008

I'd be interested in your take on Ruby on Rails too.

chris.giddings@ripplesw.net - 29 Aug 2008

What about WebObjects? The WebObjects library originally developed by NeXT (before Apple bought them) and now improved and sold by Apple seems like a really great frameworks set built on Java as well. What are the drawbacks and the advantages here?

I'm curious as someone who's written in PHP for a long time now, but I develop software on the Mac as well. WebObjects would use the same IDE I use to develop Mac based applications which is very appealing for me.

Comrade Ghorkov - 29 Aug 2008

ASP and ASP.NET aren't scripting languages. ASP is a scripting environment that can execute any scripting language for which a Script Host exists for, you can have ASP pages written in VBScript and JScript.

ASP.NET has nothing to do with ASP architectually, it's compiled (like C++), it's just an API for working with the HTTP pipeline (and server) from within .NET applications (written in any CLR-capbable language, like Managed C++, C#, or VB7+)

goldtech@worldpost.com - 29 Aug 2008

http://www.aestiva.com/pages/htmlos/products-htmlos.html

HTML/OS:

I've had good luck with HTML/OS.
It is not free...but very rapid development, has an integrated DB. Fascinating product IMO...

gerymate aet gmail duth com - 29 Aug 2008

Surely worth to mention <a href="http://www.rubyonrails.org/">Ruby on Rails</a> as a glowing crimson horse.

Ganesan Rajagopal - 29 Aug 2008

It's strange to see JSP mentioned without mentioning Servlets :-). After all, JSPs are servlets, it would be nice to briefly mention them. Also, Perl is not just CGI; mod_perl Apache extension gives it a huge performance boost. Another dark horse is Python.



Add comment
Please note that by posting a comment here you are committing it to the public domain. This is important so that others can make use of your code themselves, and also so that I can incorporate helpful notes directly into the main text. Comments are limited to 2000 characters in length.

If you are reporting an error in the content, please tell me directly.

Your name/email address:
Your comment:
 
Now, in order to verify that you're a real person, please answer this simple question: what is five plus five?
The answer is:
(please write in
numbers, eg 19)


Top-right shadow
 
Bottom-left shadow Bottom shadow