Pergunta

Estou desenvolvendo um aplicativo que precisa trabalhar com diferentes versões incompatíveis de alguma biblioteca.Meu instinto intestinal foi introduzindo um adaptador entre o aplicativo e a biblioteca que terá objeto adequado da biblioteca injetada nela.Então, alguém me contou sobre calços.Nem muita literatura está disponível sobre isso.

Eu queria saber como são os calços diferentes da fachada e do padrão de design do adaptador?E quais são alguns dos usos populares do mesmo?

Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top