Here’s an analogy (and I don’t know how useful it is). It’s about writing JavaScript for web pages.

A beetle, for example, has a hard external skeleton, to which everything else is attached. A cat, for example, has a hard internal skeleton, to which everything else is attached. A cat is soft outside (although with teeth and claws) while a beetle is soft inside.

So what’s this got to do with JavaScript and HTML? Well, a simple HTML page spruced up with some JavaScript for say form entry is a bit like a beetle, where the HTML is the hard external skeleton.

But a complex web page, constructed mostly from JavaScript and Ajax supplied data is something else. It’s too big and complex to be supported just by HTML and the DOM. It needs some sort of skeleton. And so perhaps should be built more like a cat.

This is not a new idea. The famous Model-View-Controller design pattern requires three independent but linked components. And to my way of thinking, the Model is like the skeleton.

Whether or not you like the analogy, you can ask this: Does my application have a major component that can function relying on HTML and the DOM? My view is that for complex things this is the way to go, rather than hanging everything on the DOM.

Here’s another analogy. A modern web framework, such as Django or Rails, has something like a skeleton, and then templates can be used to add presentational logic and preferences. This is so different from the old CGI-script way of doing these things.

With a modern web-framework, generating the HTML is an important but external task. The generated HTML is like the soft skin of an animal. (Yes, even the rhinoceros has soft skin, although not like a baby.) The web-framework helps provide a good part of the skeleton.

There’s a shift in attitudes and culture required to go from writing HTML web pages to writing a modern web application. Perhaps a similar shift is beginning to happen in the writing of the JavaScript side. The Google Web Toolkit is a good example of this culture shift.