Friday, June 01, 2007

PHP Description - Nailed It

I just read a similar description of PHP by Tim Bray in the Linux Journal, and I really think he nails it:

So here’s my problem, based on my limited experience with PHP (deploying a couple of free apps to do this and that, and debugging a site for a non-technical friend here and there): all the PHP code I’ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places. Everyone agrees on PHP’s upsides: it’s written for the web, it’s easy to deploy and get running, and it’s pretty fast. Those are important advantages. And I’m sure that it’s possible to write clean, comprehensible, maintainable, PHP; only apparently it’s real easy not to.

This too has been my experience. The key words in the above description are not not easy. I think I've written clean web apps in PHP, but it takes quite a bit of anal retentive discipline to do so. And even then you often need to compromise.

As Kurt Normak has noted, just having to wrap two different languages together (much less three) is a recipe for disaster. That's one of the key reasons I like SISweb so much - there's no HTML and Code to wrap up together, there's only Scheme. Heck, you can even take JavaScript out of the equation as well.

If a PHP app is a big 'ol spaghetti fest, then a web app in SISCweb is a nice steak dinner (or a really good veggie burger, if you prefer).

Update: So, I've done a bit more thinking about this today and I'd like to update (clarify?) what I said above. I don't think SISCweb (or any Scheme or Lisp, for that matter) makes writing clean applications particularly easy. I think what you have is the following language to effort/code quality:

LanguageNot TryingTrying Hard
PHPCruddy CodePretty Good Code
JavaNot That Bad CodeVery Good Code
SchemeCruddy CodeGorgeously Pristine Code

(Where scale goes from Cruddy Code == Wrapped Spaghetti Mess to Gorgeously Pristine Code == Not Really Code, but an Elegant Specification.)

That's why I write Scheme - because with effort you get something that is simply outstanding.

No comments:

Post a Comment