When not to use a relational database: generating HTML (for real this time)

Currently, the Nth post in a series of N databoombasetic posts.

In a recent posting, I supposedly railed against the practice of generating HTML using the declarative SQL language. But if you look carefully, what I actually railed against was imperative-style programming using SQL. In particular, Oracle's PL/SQL flavour of the language. HTML didn't really enter into it.

So here's a taste of the HTML-generating code deep within the execrable system that runs the College (click for the full size view):

HTML in PL/SQL

And you thought typing angle brackets seemed a waste of time. All told, there are some 84,699 non-blank lines of this verbosicode making up the website.

The code includes some real logic gems too. Note, for instance, the highlighted line number 1,584. It determines whether the visitor is browsing with Internet Explorer. Later on, there is an ELSIF statement that has the specific code for those using Mozilla-based browsers (oddly, there is no other recognized possibility, nor is there a concluding ELSE statement).

I checked, and the only difference between the two 48-line blocks of code was a single CSS class attribute (visible on line 1,590, above).

Once again, keep the code out of the database, unless you're getting paid by the line.

Archived Comments

  1. Noah on 20080219.Tuesday:
    Holy hell! I wouldn't have believed that somebody would build a system like this if I hadn't seen the code with my own eyes.
  2. Dave on 20080220.Wednesday:
    The website is just a tiny part of this system. There are 3,600 database tables (all with 7-letter names), 1,800 7-letter Oracle forms, and 570 7-letter reports written in C, all adding up to some 2.9GB of application files. Now, any large system like this is going to be clumsy. I don't think I could design it better, just different (8 letter names? 10?). But that doesn't make it any less enjoyable to complain about it endlessly.
  3. AOF on 20080330.Sunday:
    Ahhh! My eyes! My eyes! And you'd not only have to be paid by the line but paid DOUBLE to MAINTAIN each line :-D
  4. Dave on 20080331.Monday:
    I seriously worry about the programmers. Day after day after interminable day of writing this stuff has to take a toll. On a cloudy morning one of them might show up with a shotgun. So I guess I worry about the other programmers.

Comments