Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Mark Leighton Fisher (4252)

Mark Leighton Fisher
  (email not shown publicly)
http://mark-fisher.home.mindspring.com/

I am a Systems Engineer at Regenstrief Institute [regenstrief.org]. I also own Fisher's Creek Consulting [comcast.net].
Monday November 03, 2003
03:17 PM

HTML, A Declarative Language for GUIs

[ #15539 ]

HTML is a declarative language for GUIs, which is a Good Thing for developers and users. This is both obvious and non-obvious. It is obvious (IMHO) to those developers of end-user software who already avoid the tedium of normal GUI programming along with "DLL hell" by creating applications for their user's web browser, thereby also delivering more applications faster. I'm not sure it is obvious to those who create development software, as they seem to lament how UIs have regressed since HTML has taken over.

Declarative (rule-based) language programs are made up of a set of declarations (or rules) along with a set of meta-rules on how the rules are interpreted. General-purpose declarative languages such as Prolog are not commonly used, but domain-specific declarative languages like Makefiles, Module::Build Build.PL files, and YACC .y files see a lot of use. (Installlation program builders also are often implemented at least partially as declarative languages.) This is just rank speculation (as I've only read about using Prolog and other general-purpose declarative languages), but declarative languages seem best used when there are clear, unambiguous rules about how the language is interpreted, which is why they've had such success as domain-specific languages. One constant theme in what I have read about Prolog is how easy it is to write Prolog that takes an inordinate amount of time to run, which I attribute to the relative difficulty of understanding how the Prolog code will be interpreted. In my experience, you don't see this with the domain-specific declarative languages.

HTML appears to be the first commonly-used declarative language for GUIs. (If anyone knows of another, please let me know.) This probably marks an advance in the state of the art, as a domain seems to need to be fairly well understood before a usable declarative language can be written for it. Although HTML allows you to escape to JavaScript (a mostly object-oriented language), many common GUI tasks can be accomplished purely through HTML. The beauty of declarative languages is that they function at a higher level, thereby increasing the "chunkiness" of the language -- "chunkiness" refers to how large are the atomic concepts of the language. For example, regular expressions are an atomic concept in Perl, whereas in C regular expressions reguire multiple function calls to implement. HTML reduces many GUI constructs to one or two lines.

Domain-specific declarative languages can be markedly easier to program than conventional procedural, object-oriented, or functional languages due to their "chunkiness". Even with a good framework, traditional GUI programming requires writing lots and lots of relatively low-level statements. In HTML, however, a couple dozen lines or so can provide the document submission interface to a knowledge management application (I've done this). The true mark of this ease of programming (IMHO) is that nowadays many embedded computers are controlled through a web browser interface. Embedded systems are resource-constrained environments, where you only include the necessary features in the least resource-intensive way possible. HTML (and HTTP and CGI) wouldn't be used in embedded systems if it wasn't an efficient way to provide a GUI.

The advent of HTML GUIs has meant for me that I give a GUI to a lot more applications, even small utilities I write mainly for myself (like my Dublin Core metadata creator). Just as Perl might not exist without YACC, many HTML GUI applications might not exist if they had to have been programmed as regular GUI applications because of the additional complexity of programming a regular GUI as compared to the ease of working with HTML's declarative GUI. Regular GUIs have infinite flexibility, but they require writing (almost) an infinite number of statements to exercise that flexibility. A declarative GUI is a big advance for developers, as it enables the professional developer to create more GUI applications faster, while casual developers - people who do not even think of themselves as programmers - can create simple GUI applications, the kind of applications that reguired a professional developer to write in the days before HTML's declarative GUI.

HTML's current deficiencies as a GUI language will not slow its adoption, as HTML provides a significant fraction of the power of regular GUIs at a fraction of the cost (which is probably the 80/20 rule in action). Like PCs before it and PDAs alongside it (this was written on PalmOS), HTML often makes a developer's task a lot easier.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Interestingly, during the PDC that just finished up in LA, Microsoft claims that GUIs can be built with declarative XML if you target their next generation GUI in Longhorn.
  • I've had the same feeling about HTML for a while but had never thought to ascribe the ease of use to it's declarative nature. But it makes perfect sense now you've said it :) Reminds me how in awe of LaTeX I was when I first started using it.

    The challenge that interests me is adding a couple of helper technologies to the HTML - a little bit of Javascript and a little bit of SQL working together with some backend Perl code to create something more pleasant and more productive for full blown GUI developme

  • I thought that Mozilla uses XML to compose its GUI? The project name is XUL [mozilla.org], short for "XML-based UserInterface Language".