分享

Module Interface Separation

 MG的图书馆 2009-04-07
Web Client Software Factory - February 2008
Module Interface Separation

Problem

You have a large smart client application that is composed of multiple modules written by different teams. Some modules have dependencies on other modules. For example, the accounts module requires the logging service in the infrastructure module. To access the logging service interface, the accounts module has an assembly reference to the infrastructure module assembly. Each time the implementation of the infrastructure module changes, the accounts module must be recompiled. Figure 1 illustrates the dependencies between application modules.

Cc304867.8ffb34ec-0c9c-4848-85da-f2712251773a(en-us,MSDN.10).png

Figure 1
Module dependencies

Forces

  • You want to be able to change the implementation of a module without requiring a recompilation of dependent modules.

Solution

The problem is solved by breaking the module into two assemblies:

  • The interface assembly
  • The module implementation assembly

The interface assembly should contain public elements of the following types:

  • Service interfaces
  • Business entities (if they are passed between modules)

The module implementation assembly contains the implementation of your module. In this way, you can change the implementation of a module without requiring a recompilation of dependent modules. The dependent modules must be recompiled only when the interface assembly changes. Figure 2 illustrates the dependencies between modules and the interface assemblies.

Cc304867.48c5a2db-f726-4fa0-905d-c1496a8bda33(en-us,MSDN.10).png

Figure 2
Separation of interface and implementation for modules

Liabilities

  • Your solution contains more projects to manage.

More Information

The Add Business Module and Add Foundational Module recipes include an option to automatically generate an interface project for the module being created. For more information, see How to: Create a Business Module and How to: Create a Foundational Module.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多