Wednesday, September 16, 2009

Layers Pattern

The Layers pattern helps structure applications that can be decomposed into groups of subtasks in which each group of subtasks is at a particular level of abstraction.

Maybe I look at it differently, but layers is another way of saying hierarchical modules with loose coupling. I may not have tasted the 7-layer dip of the network, but I have dabbled in n-tier client/server systems. One development had decided to bubble up trapped error messages with a full stack in order to provide the most suitable amount of information to the users and developer.

Developing in layers provides an advantage for allowing incremental coding and testing to occur without disturbing other protocols. When thinking about layering, you should consider the following forces (as you battle Darth Vader):
  • Late source code changes should not ripple through the system.
  • Interfaces should be stable.
  • Parts of the system should be exchangeable.
  • Possibility of building other systems at a later date with the same low-level issues as the system currently being designed.
  • Similar responsibilities should be grouped to help understandability and maintainability.
  • The system will be built by a team of programmers, and work has to be subdivided along clear boundaries.
For the future, I think the mobile communication industry will continue improve the "middle layer" of a common infrastructure. Object designs end to be too tightly constrained to the limits of the specific application. Many designers tend to put too much of the logic of an application in the GUI layer. The end result is few domain objects that are potentially available for reuse in other applications.

No comments:

Post a Comment