|Research, training, consultancy and software to reduce IT costs|
Programming for Web 2.0
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:
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.
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
Minimal IT: research, training, consultancy and software to reduce IT costs.