During design meetings at my workplace and even during other conversations with friends, the term "shim" appeared to being placed offhand, with the context not being setup properly to indicate what it is exactly that the "shim" represented.
Clearly I wasn't the first person to come across this concern, as evidenced by the person who asked this question on stackoverflow:
The popular answer to that linked question, fits great for all the uses of shim that I came across in my conversations. So being the novice that I am I decided to look further into the gang of four to see how shim might describe an adapter, facade, or proxy in Structural patterns.
Adapter: When shim is describing a code construct that facilitates interactions between two classes with incompatible interfaces. This term implies that certain translations need to be made in the adapter.
Proxy: It's mostly a passthrough to another component where restrictions could be placed on how the wrapped component is accessed.
Facade: Typically used as a way for the client to access all functionality exposed by a complex system through one component rather than multiple different components.
Shim is likely still an acceptable term, when the component is acting as a combination of adapter and a proxy, but if the component does fit in with a more specific role of being a proxy, adapter or facade, then using that term should be encouraged in design meetings to avoid confusion.
P.S.: https://en.wikipedia.org/wiki/Design_Patterns, is a wonderful resource for learning more about these terms.
Create your free account to unlock your custom reading experience.