Multi-Languages Adapter

不是正式的 Pattern Documentation, 只是隨手記記, 這種情況其實還蠻常遇到的. 但需要進一步討論的是, 如果我們說 Programming Languages 的選擇決定通常是在 Design Phase 末期或是 Implementation Phase 初期, 那麼這個情況是否 應該出現 呢 ? 而如果出現了, 是否下面的 能夠使用 呢 ?

Context

Used when components developed in different programming languages, which with low interoperability between each other, have to communicate and collaborate together.

Solution

Use a common infrastructure as a language-independent third party media, and develop a common protocol as communication standard.

The ProtocolAdapter is responsible for maintaining the Protocol, translating language-specific message into message under Protocol, and vice versa.


Example

An example using socket and TCP/IP network is illustrated bellow.


Consequences

  • Increase the reuse of components implemented in different programming languages.
  • The language-independent third party media usually contributes to constraints on usage of the applied application. Usability may be somewhat sacrificed.
  • There will definitely be performance issues.
Associated Patterns
  • Mediator Pattern
  • Adapter Pattern

0 意見:

Designed by Posicionamiento Web | Modified by seLain | Bloggerized by GosuBlogger | Blue Business Blogger