One line of code: 4 languages
I was showing a friend a line of code I wrote tonight. It’s nothing special, just a progress indicator that is displayed when a form is posted. I realized, though, that the one line of code touched four different ‘languages’, and a larger number of areas of know-how:
$('view').innerHTML = '<img src="/images/indicator.white.gif" />';
- Javascript.
- HTML (markup language)
- CSS (formatting language)
- PHP
The line is emitted Javascript (reacting to a DOM event in an HTML form), produced by Php. The Javascript is writing some HTML to a DOM node, which is styled based on a set of defined CSS classes.
The line implies knowledge of the W3 DOM, and requires understanding the scriptaculous and prototype library (which hides the wonders of the DOM access and XmlHTTPRequest). Putting together the application quickly also required some understanding of Unix, which itself touches several tools. If the form were doing anything interesting, it would also bang up against SQL. And you know what? It’s not a half-bad way of building an application with a user interface.
I’ve been hacking at another incarnation of my natural-language markup plugin (smarky), and decided to put up a quick web-based test interface. The web interface took less than 10 minutes to whip together, containing only a handful of code and a small bucket of markup.

RSS