[Wolves] Scripting language comparisons

Aquarius wolves at mailman.lug.org.uk
Wed Apr 30 14:03:01 2003


Matthew Revell spoo'd forth:

> Hi,

> I'm writing an article on the comparative advantages of the various
> scripting languages that can be used for websites. It's aimed at online
> content professionals - website editors, information architects, online
> writers etc. - to give them an idea of the languages that are available.

> The languages/technologies I'm going to cover are:

> PHP
PHP is either the most popular or second most popular web scripting language. 
It's widely used, C-based, and canonically embeds code throughout HTML in the 
same way as ASP. There are a vast array of modules that allow it 
to do pretty much any task that might be required, along with bindings to 
externaly-available libraries. It is also open source; in essence, it can be 
viewed as an open-source cross-platform competitor to ASP. Although primarily 
developed and maintained as a web scripting language, it can be used for 
generic (non-web-connected) programming tasks. There are also various 
templating engines available for PHP, such as Smarty (http://smarty.php.net/), 
which allow coders to disassociate code from HTML.

> ASP
ASP is, technically, not a programming language. Instead, it's the name for a 
technology that allows you to embed a programming language in HTML, and also a 
technology that provides a consistent object model for input and output of 
data. For example, it's possible to have "ASP" pages that embed VBScript, 
JavaScript, Perl, Python, or any other language supported by the Windows 
Scripting Host. In practice, however, when people talk about "ASP" they 
generally mean "ASP/VBScript". VBScript is, as mentioned in another mail, a 
cut-down version of VIsual Basic. It's missing a fair few features that better 
languages have: for example, variable numbers of parameters to functions (and 
default values), the ability to pass functions around as objects, and any kind 
of introspectivity. It is either the most popular or second most popular web 
scripting system in the world (depending on whether you believe the PHP 
people or not), and the vast majority of ASP pages are ASP/VBScript. Note 
that, although ASP/PerlScript and ASP/PythonScript require extra downloads, 
ASP/JScript (JScript is Microsoft's codename for their version of ECMAScript, 
as JavaScript is Netscape's codename for their own version) is an 
out-of-the-box supported configuration. Modern JavaScript is an accomplished 
and detailed language; although early versions were limited, JavaScript is 
unfairly tarnished by its reputation as a simple client-side language. See 
http://www.crockford.com/javascript/javascript.html for more details on how 
powerful and expressive JavaScript is (much more so than VBscript, and much 
more so than PHP, too, as a language). Part of the reason that VBScript is 
limited as a language is that you are supposed to use it as glue; the MS ethos 
surrounding it is that it will be used as the display layer which talks to a 
middleware COM layer (of COM objects and DLLs built in a more capable 
language). This has been superseded in recent years by ASP.NET.

>ASP.NET
ASP.NET is the web programming section of Microsoft's .NET, a nebulous group 
of technologies. Again, ASP.NET pages can be written in any .NET-capable 
language, but the MS-supported choices are VB.NET and C#. VB.NET looks like 
Visual Basic to a certain extent; like classic ASP, .NET is really about 
providing an object model to code that runs in a web page to get access to 
data.

> Perl
Perl is the 500-pound gorilla of text processing languages, and was heavily 
used for web programming when all web programming was CGIs. Since the 
appearance of PHP, its use has dropped somewhat. Being a generic programming 
language first, and a web programming language only as a consequence of that, 
a Perl web program will canonically be a script which generates HTML, as 
opposed to the ASP/PHP model of having code distributed through HTML. Perl is 
an extremely powerful language, especially in the text processing domain, but 
there is a high learning curve, particularly for novice users (the typical 
17-year-old-with-Dreamweaver who populates a fair portion of web "design" 
shops). More suited to back end code than display code, unlike PHP and ASP 
which are the other way around. The Apache::ASP module 
(http://www.apache-asp.org/) provides the ASP object model and 
code-embedded-in-HTML ethos to Perl running on Apache, but it's not the 
canonical use of Perl as a web language.

>Python 
Python, like Perl and unlike the other suggested languages, is a generic 
language that can be used for web programming rather than a web programming 
language (which can potentially be used generically, as PHP can). While not as 
strong in the text processing arena as Perl, it is mostly conceded to be 
simpler to learn, especially for programming novices. Much like Perl, again, a 
typical Python web program is a CGI which generates HTML (although there are 
ASP/PHP-style embed-Python-in-HTML processors, such as my own Castalian 
(http://www.kryogenix.org/code/castalian/)). 

>JSP 
Much like Java, JSP is popular in the enterprise arena, especially by 
those who develop cross-platform products with a web interface (MS-only 
enterprise products will often have their web interfaces in ASP + COM). JSP 
also comes with the idea of "servlets" as part of the package; servlets are 
encapsulated bits of code, much like Microsoft's COM objects. 

>Coldfusion.
Cold Fusion takes a different approach to both Perl and ASP; instead of 
embedding code in HTML, or writing code that generates HTML, it looks like 
HTML. THe language is made up of a series of tags which are actually commands, 
such as <cfloop>...</cfloop>, which defines a loop. CF has fallen out of 
favour in recent years, although it is still developed by its parent company 
(MacroMedia) as part of their "MX" range.

...oooOOOooo...

I've tried to be as objective as possible here. Anyone who knows me will tell 
you that I'd recommend Python heavily as a scripting language, both 
generically and for web tasks. I'd also strongly recommend against Cold Fusion 
(Steve Champeon once said that "using Cold Fusion to teach programming 
concepts is like using collage to teach surgery".) I'm a little light on JSP 
and ASP.NET experience, so someone else can fill those in. The bit about 
JavaScript actually being really powerful as a language is important: those of 
you (which is pretty much all of you, I bet) who think that it's just for 
noddy client-side web stuff like swapping images should follow the link and 
see how accomplished a language it is. 

sil

-- 
There have to be people like me, so people like you can look so clever.
-- Max Jaeger, Fatherland