Tuesday, December 2, 2008

Composite WPF Guidance - Part 2 (Patterns)

The Composite Application Guidance for WPF involves applying varios design patterns when building composite user interface (UI) applications. Some of the patterns used in a Composite WPF applcation development are:
  • Seperated Interface and Plug In pattern
  • Inversion Of Control
  • Service Locator
  • Command
  • Adapter
  • Seperated Presentation
  • Event Aggregator
  • Facade etc

I will explain the use of these patterns in the Composite WPF development using CAL and their significance in the forthcoming articles.
Seperated Interface and Plug In pattern: The ability to locate and load modules at run time encouraging a more loosely coupled application development using CAL is enabled by the Seperated Interface and plug in pattern.
In CAL the quality of its design is improved by reducing the coupling between the system's parts. This is acheived by grouping the classes into packages and controlling the dependencies between them. However, you can invoke methods in other packages by defining an interface in one package but implement it in another. This way a client that needs the dependency to the interface can be completely unaware of the implementation. In CAL each module implements the IModule interface which provides a good plug point for Gateway. The below figure shows the seperated interface implementation in CAL.

Plug In pattern allows the concrete implementation of a class to be determined at run time to avoid requiring recompilation due to which concrete implementation is used or due to changes in the concrete implementation. In the Composite Application Library, this is handled through the DirectoryLookupModuleEnumerator, ConfigurationModuleEnumerator, and the ModuleLoader. The figure below describes the plugin implementation in CAL.

We will look into the other patterns in the following series in CAL.

No comments: