shim (plural shims) (informal, often derogatory) A transsexual person, especially a trans woman; (loosely) a drag queen or transvestite.
Plain and simple, a shim is a tapered wedge used for making slight adjustments to home elements, such as door frames and windows, to make them plumb and level. The most common shims are wood (often cut from cedar or pine) and serve well for almost any interior adjustment.
In this page you can discover 6 synonyms, antonyms, idiomatic expressions, and related words for shim, like: bushing, flange, mandrel, ferrule, backplate and spacer.
In referring to gender, "shim" denotes a non-determined sex of an unborn fetus. The word was coined by Steven Bill, a self-proclaimed etymologist, who became frustrated in not knowing how to refer to a friend's unborn baby without knowing its gender.
An example of a shim:
A shim is some code that takes care of what's asked (by 'interception'), without anyone being any wiser about it.
An example of a shim would be rbenv (a neat ruby tool). Calls to ruby commands are "shimmed". i.e. when you run bundle install
, rbenv intercepts that message, and reroutes it according to the specific version of Ruby you are running. If that doesn't make sense try this example, or just think of the fairy god mother intercepting messages and delivering apposite outcomes.
From Wikipedia:
In computer programming, a shim is a small library that transparently intercepts an API, changing the parameters passed, handling the operation itself, or redirecting the operation elsewhere. Shims typically come about when the behaviour of an API changes, thereby causing compatibility issues for older applications that still rely on the older functionality. In these cases, the older API can still be supported by a thin compatibility layer on top of the newer code. Shims can also be used to run programs on different software platforms than they were developed for.
The term "shim" as defined in Wikipedia would technically be classified, based on its definition, as a "Structural" design pattern. The many types of “Structural” design patterns are quite clearly described in the (some would say defacto) object oriented software design patterns reference "Design Patterns, Elements of Reusable Object-Oriented Software" better known as the "Gang of Four".
The "Gang of Four" text outlines at least 3 well established patterns known as, "Proxy", "Adapter" and "Facade" which all provide “shim” type functionality. In most fields it’s often times the use and or miss use of different acronyms for the same root concept that causes people confusion. Using the word “shim” to describe the more specific “Structural” design patterns "Proxy", "Adapter" and "Facade" certainly is a clear example of this type of situation. A "shim" is simply a more general term for the more specific types of "Structural" patterns "Proxy", "Adapter", "Facade" and possibly others.
According to Microsoft's article "Demystifying Shims":
It’s a metaphor based on the English language word shim, which is an engineering term used to describe a piece of wood or metal that is inserted between two objects to make them fit together better. In computer programming, a shim is a small library which transparently intercepts an API, changes the parameters passed, handles the operation itself, or redirects the operation elsewhere. Shims can also be used for running programs on different software platforms than they were developed for.
So a shim is a generic term for any library of code that acts as a middleman and partially or completely changes the behavior or operation of a program. Like a true middleman, it can affect the data passed to that program, or affect the data returned from that program.
The Windows API is an example:
The application is generally unaware that the request is going to a shim DLL instead of to Windows itself, and Windows is unaware that the request is coming from a source other than the application (because the shim DLL is just another DLL inside the application’s process).
So the two programs that make the "bread" of the "shim sandwich" should not be able to differentiate between talking to their counterpart program and talking to the shim.
What are some pros and cons of using shims?
Again, from the article:
You can fix applications without access to the source code, or without changing them at all. You incur a minimal amount of additional management overhead... and you can fix a reasonable number of applications this way. The downside is support as most vendors don’t support shimmed applications. You can’t fix every application using shims. Most people typically consider shims for applications where the vendor is out of business, the software isn’t strategic enough to necessitate support, or they just want to buy some time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With