Minimal IT logo and link to home page
Research, training, consultancy and software to reduce IT costs
Home | About | Newsletter | Contact
Previous | Next Printer friendly
20 October 2009

Programming for Web 2.0

By Andrew Clifford

How should we design and code for Web 2.0?

One of our customers said he liked our Metrici Advisor service, but that it needed to be "more Web 2.0".

I was not sure what Web 2.0 meant, so I looked it up. Different people define Web 2.0 differently. It can mean:

  • Bold and simple visual style.
  • Richer and more dynamic user interface.
  • Merging of content with other sites.
  • User control over the web experience - "My web, my way".

It would be easy to get diverted into just one of these - a styling make-over, some JavaScript wizardry, some website feeds, or customisation options for the user. But before we looked at individual requirements, we wanted to know whether the underlying software was in a fit state to support Web 2.0, whatever it is.

Like all good web applications, Metrici Advisor separates the underlying logic from the user interface. It also separates the different parts of the user interface: the controller that manages the interaction with the user, the view that determines the content that the user sees, and the visual style for the content (implemented as cascading style sheets, CSS).

The separation between logic and user interface is very thorough, but there were some problems with the separation between the different parts of the user interface.

The view contained extra markup just to support the styling. The styling mixed the visual style, the overall page layout, and the layout of individual controls. This made the style hard to change. We fixed this by removing all style-related content, and restructuring the CSS so that the visual style, page layout, and individual controls are implemented in separate files.

Controller and view components contained hard-coded references. For example, a typical view component outputs a web page which contains references to the actions the user could take. The controller code that responds to those actions contains hard-coded references back to the views. Although the code was clearly separated, it was heavily coupled.

We fixed this by using a file to configure all the pages, and the references between view and controller components. This allows us to reconfigure the service to present different applications to different users. It also allows us to merge content from other sites, or expose meaningful subsets of our service for consumption by other sites.

We introduced themes, which collect together overrides for the standard user interface. The themes let us include the JQuery JavaScript library to provide more dynamic functionality, without modifying the underlying user interface code.

None of these changes of themselves achieve the Web 2.0 requirements, but they make it much easier to restyle the service, to build a richer and more dynamic user interface, to interact with other sites, and to give the user more control. Since making these changes we have created a number of customised versions of the service which have been well received.

Stepping back from all of this, the changes we have made have just been old-fashioned good practice: clear separation of responsibilities, decoupling, and removing hard-coding. Web 2.0 sounds new, but it requires the same disciplines I learnt programming COBOL 20 years ago.

I am still not sure what Web 2.0 means, but I know how to program it.

Next: Development tools are dangerous

Subscription

Subscribe to RSS feed

Latest newsletter:
Magical metadata

We use the term "metadata-driven" to describe IT solutions in which functionality is defined in data. Taking this to the extreme can provide unparalleled levels of speed, simplicity and versatility.
Read full newsletter

System governance

System governance helps you implement high-quality systems, manage existing systems proactively, and improve failing systems.

Find out more