質問

いくつかのライブラリの異なる互換性のないバージョンを扱う必要があるアプリケーションを開発しています。私のGUT本能は、アプリとライブラリの適切なオブジェクトがそれに注入されたアプリケーションとライブラリの間にアダプタを導入していました。それから、誰かがシムについて私に言った。多くの文学がそれについて入手可能ではありません。

ファサードとアダプタのデザインパターンとはどのように異なるシムがどのように異なっていますか?同じ?の一般的な用途は何ですか?

役に立ちましたか?

解決

In my eyes, an Adapter and a Shim would be the same.

A Facade on the other hand serves a different purpose. If you expect your client code to need to be able to pull back the curtain, so to speak, and access the underlying library without using your object model, that would be a Facade. Facade presents a simplified or common set of objects/methods on top of a more complex system, but still provides access to the underlying complexities when additional behavior is required.

The use of Adapter means your client code is completely, blissfully unaware of the underlying implementation details.

他のヒント

IMO, Adapter and Shim functions similarly but means something different.

A Shim usually has very similar, if not exact, set of interface with the object being "shimmed." For example, proxy objects could be considered somewhat like a shim.

While an Adapter usually has quite different, if not completely different, set of interface with the object being "adapted."

Note the "shim" and "adapt" verb. That's how I usually differentiate the two.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top