XML.com: XML From the Inside Out
oreilly.comSafari Bookshelf.Conferences.


Design Patterns in XML Applications

January 19, 2000

Part One: Traditional Patterns in XML applications


Design Patterns in XML Applications
Command Pattern
Flyweight Pattern
Wrapper Pattern
Iterator Pattern

Adequate documentation of the experience gained during the development of XML-based systems is a prerequisite for XML's success as a widely used technology. Design patterns have proved to be a very good technique for transmitting, and to some extent formalizing, knowledge about recurring problems and solutions in the software development process.

This article, the first of two articles on XML and design patterns, is focused on the applicability of some well-known design patterns to XML-specific contexts.

This article assumes some basic knowledge about XML processing. Also, basic knowledge about UML class diagrams will be useful (see our basic UML class diagram guide).

What are patterns?

Patterns are an effective way to transmit experience about recurrent problems. A pattern is a named, reusable solution to a recurrent problem in a particular context.

Patterns are not miraculous recipes that will work in every scenario, but they do convey important knowledge, a standard solution, and a common language about a recurrent problem. All this makes them powerful design tools.

Since common problems with (often) common solutions appear in many scenarios, patterns are now used in almost every part of development: there are process patterns, architectural patterns, implementation patterns, testing patterns, etc. However, one particular kind of pattern has received special attention from the development community: design patterns. Design patterns are a powerful reuse mechanism, and a way to talk about design decisions that actually work.

The expression XML patterns may be used to denote two kinds of patterns: (1) design patterns specifically treating XML-related problems, and (2) information structuring patterns for the design of DTDs, schemas, etc.

XML patterns will be discussed more fully in the next article. Here we will focus on the applicability of traditional design patterns to the design of XML applications.

Traditional design patterns are often classified in categories. One common set of categories is structural patterns and behavioral patterns. In this article we will explore the applicability of patterns in each of these categories to XML problems.

The patterns we will discuss are: Command pattern, Flyweight pattern, Wrapper pattern, and Iterator pattern. The choice of patterns for this article notwithstanding, any other pattern can be applied to the design of XML applications.

Choosing the right patterns to present has not been easy. I have tried to maintain a balance between the different options, thus there are two structural and two behavioral patterns; two DOM-oriented and two event-based application discussions; and two of the patterns are illustrated using C++ and two using Java.

Pages: 1, 2, 3, 4, 5, 6

Next Pagearrow