This afternoon I was given the URL of an Open Source project that we're thinking of using at work. So I go off and download it.
It's basically a web front end to a database, so the developers have chosen to implement it in a combination of PHP and Javascript. I know a bit of each of them so I start to look at the code.
Doesn't take me long to realise that the code is really nasty in oh so many ways. Even their HTML is so crufty that half the pages don't work on Mozilla.
I start to have a bit of a rant about this on the #london.pm IRC channel. "Why is all Javascript and PHP so nasty?", I ask, "and why can't people use a proper language?"
But then I stop as I realise something.
If you find a random web application that is written in Perl, you will almost certainly find exactly the same thing. Badly designed applications and nasy hacked-together code. The vast majority of Perl code out there is appalling. I've said that before.
So anyone coming to Perl in the same way that I'm coming at PHP and Javascript would have exactly the same experience. It's not that the authors of this are using bad tools (they may well be, but that's not the issue here) it's that they are bad programmers. And that means they'll write bad code no matter how good the tools they use are.
Hey, cool, I'm not alone anymore!!! I've been saying that EcmaScript (formerly known as JavaScript) is actually a pretty decent language if you use it properly and have a good implementation (say, the Mozilla engine that also powers Adobe's SVG viewer).
I wrote a bunch of large GUI apps in EcmaScript and quite frankly it was all clean and well done, and worked really well. For sure, I would have preferred it to be Perl but overall I can't say that it made much of a difference.
Now the problem is, how does one explain to a DreamWeaver Kiddie the importance of clean code...
Re:Not alone anymore!!!
jdavidb on 2002-07-05T16:26:44
Doing it properly has to include "using it for proper purposes." I've seen way too many simple form-based applications that failed to work for me because they tried to do something special with JavaScript when a straightforward, copy out of a textbook CGI program should have been used.
This is why I think percentage of "good", say, Java code is higher than percentage of "good" Perl code. It is not because Java is better. It is because Perl is easier to learn and program in.