Active Web Sites and Comparison of Scripting Languages
The tools and technology for building websites has come a long way since the first simple websites were built in the mid-1990s, with text-editors and a book about basic HTML. Abandoning brochure-like glossy websites, much of the industry has finally understood that, as we predicted, live content has become the standard by which sites are judged.
Live content websites inevitably have a database behind them and use some form of content generation to produce the HTML pages. There are numerous ways of doing this, including not ony proprietary specialist solutions but also general purpose programming and scripting tools.
We've had quite a lot of experience of developing with the various scripting languages and have frequently been asked to compare PHP versus ASP, Perl vs JSP, or any combination of these four, e.g. we are often asked for comparative evaluations from companies thinking about building our Perl training or our PHP training into their website development strategy.
We thought it might be useful to outline our findings in the paragraphs below. If time permits we'll expand this to include more, but for the moment here is our brief view of the strengths and weaknesses of the tools available, starting with
PHP – www.php.net is a remarkable success story. Starting as a simple scripting language for adding basic dynamic content to websites, it has grown to become one of the most used web programming languages into a major project. PHP is free for download and works very well on all of the Unix-like, Linux and Windows platforms. It is said to be the 4th most popular programming language. Since PHP pages work well on all of those platforms, a particular strength is that it can be used to develop websites on a desktop system and then deployed on industrial-strength and secure servers such as those found commonly only running Unix or Linux.
The hugely successful xampp bundle of Apache, MySQL, PHP and perl has helped the rapid uptake of PHP on platforms, helping to replace the notoriously insecure IIS server. Since none of Apache, MySQL or PHP requires any form of commercial licence and all are battle-proven on high volume websites, these are very attractive options for those who come from the world of highly-priced proprietary packages.
PHP has a thriving developer community, numerous contributors, a wide range of features (extensible through plug-ins) and is used in thousands of websites around the world. The range of back-end databases supported by PHP meets all but the most unusual need.
Language purists will point to some of the design choices in the implementation of PHP with some disdain – many indicating a preference for Perl – but PHP has proved itself easy to learn and tends to be particularly popular with those who have to deliver results rapidly and who aren't necessarily committed to taking advanced courses in programming and languages.
The world-leading Apache webserver is usually shipped with a built-in interpreter for PHP (a module called mod_php).
The PHP drawbacks that we have found are: the inability to insist that variables be declared before use; underdeveloped library mechanism (lacking Perl's true ‘module’ concept) and occasional linguistic quirks.
Its benefits are its ease of deployment, large number of programming libraries available from PHP (177 in May 2006), ease of use and huge body of support in the industry.
Perl – www.perl.com is one of the longest running and most successful free open-source projects. Embracing both a programming language and a whole philosophy of usage and design, Perl has quietly and without much hype, provided a better case-study of extensible and reusable software design than almost anything that has gone before it. It is very hard to find a computer system that hasn't some form of support for Perl available. Those who like to think of themselves as serious programmers, or programming language specialists, tend to speak in very high terms of the language.
An astonishing range of free extensions (modules) exist for Perl, by far outweighing the impact of Perl simply as a vehicle for expressing programs
The database-independent library for Perl (DBI) is simply one example; programs which take advantage of this are largely independent of the underlying database engine; which is hidden by database-specific drivers all working transparently throught the DBI interface.
The Perl interperter for Apache (mod_perl) was one of the first plugins for Apache to become widely used.
Whilst it is hard to find bad things to say about Perl, it probably presents a more daunting challenge for non-programmers who want to complete simple tasks with active websites, requiring rather more learning before starting than say ASP or PHP.
It is, however, likely to be one of the best choices in the long run, especially where a considerable volume of software development and site maintenance is required, i.e. for large, complex sites subject to many and radical changes.
VB Script is a version of Visual Basic (without the visuals) and with features tailored to make it suitable for use for building websites on Microsoft platforms. As you would expect with a giant like Microsoft it has spawned a considerable sub-industry of bolt-ons and plugins, mostly attracting licensing fees.
Since ASP and VB Script are closed-source, any bugs or security advisories that are discovered linger at the whim of the Microsoft until they are fixed. One website we built discovered a severe (showstopping) bug in ASP / SQL Server 2000 which remained unfixed for more than six months and cost us two staff-months of wasted time trying to find workarounds. In the Perl or PHP worlds, it would have been quicker and cheaper for us to find the cause of the bug, fix it, submit it back to the maintainers and then carry on.
VB Script uses Active Data Objects and (typically) the ODBC interface to provide good database independence. It is an adequate programming language, but is liked even less than PHP by our purists. Simple websites are easy to build and there is a range of supporting tools to help beginners. Unfortunately, since it isn't really cross-platform we can't recommend it.
Java Server Pages (link to Jakarta project) is reminiscent in nature of the Microsoft ASP framework, but intended from the ground up for enthusiasts of Java, Enterprise Beans and the whole industry that has grown up around them. A detractor of the juggernaut might describe it as being for people with more money than sense but we try to remain agnostic.
Choosing to use the panoply of tools and techniques engrossed by this world is not a tactical or pragmatic choice of how to get something built but is likely to based more on a strategic perception of how you believe the industry will develop. If all you want is an active website with a database backend, this is going to be overkill unless you already have the range of skills in-house. Entrance to this world is a cultural conversion, not a choice of one simple programming language over another.