My other documentation sites:
[HelloWorld@SiteBurg]
[Virtual Library]
[JavaMania]
[Сайт корпорации 999]
Google
 
Web helloworld.siteburg.com
vlibrary.h10.ru u.pereslavl.ru
[ Team LiB ] Previous Section Next Section

Strategies

Consider these strategies when implementing the Layers pattern:

  • Stub layer implementations for prototyping— Splitting application functionality into layers enables you to define stubs for layers that enable you to develop components concurrently or build unoptimized versions for early demonstrations or prototypes. Stub layers are also helpful for building the entire layered structure early in your development process. This is important since it helps to ensure that the layers will interact as you predict. Sometimes unexpected layer interdependencies crop up, requiring you to redefine one or more layers in your system. It is much easier to fix this type of problem before you build a significant quantity of code that depends on the problematic structure.

  • Design from the top down or bottom up— As you design an application's layered structure, your design goals affect which end of the stack to begin with. Starting at the top enables you to focus on application requirements and use cases first. Conversely, working from the bottom forces you to address core implementation details first.

  • Isolate layer initializationFigure 4.3 shows a recommended layering structure. Each layer depends on the next layer's abstraction, but you must plug in concrete implementations at runtime. Coupling layer implementations usually happens by passing a ConcreteLayerM+1 instance to a ConcreteLayerM instance as a constructor parameter or by setting an attribute. At that point, the ConcreteLayerM instance saves a reference to the ConcreteLayerM+1 instance so that it can invoke its operations.

    As the number of layers increases, it gets difficult to keep tabs on the combination and ordering of layers. It helps to isolate all layer initialization code within a single module, which also serves to precisely describe the application's overall layering structure application in one place. If you find that you need to rearrange layers, you can do so within the initialization module.

    [ Team LiB ] Previous Section Next Section
    Rambler's Top100
    Virtual Library
    All technical
    documentation