Shim
ELI5 — The Vibe Check
A shim is a thin piece of code that makes old things work with new things (or vice versa). It's like an adapter plug for traveling — your device doesn't fit the foreign outlet, so you put a shim in between. In code, shims make incompatible APIs compatible by wrapping one to look like the other.
Real Talk
A shim is a library or code snippet that intercepts API calls and provides a compatibility layer, typically to backport newer APIs to older environments or to normalize differences between platforms. Unlike polyfills (which implement missing features), shims can also modify existing behavior. The term comes from the thin piece of material used to fill gaps in construction.
When You'll Hear This
"We added a shim so the legacy API works with the new frontend." / "The Node.js compatibility shim lets Deno run Express apps."
Related Terms
Adapter Pattern
You're in Europe with a US charger. You need an adapter. In code, your app expects a PaymentProcessor with a .pay() method, but the new Stripe SDK uses .
Legacy Code
Old code that nobody wants to touch but everyone depends on.
Polyfill
A polyfill is a piece of code that teaches old browsers new tricks. Browser doesn't support Promise? Here's a polyfill that fakes it.
Wrapper
A wrapper is code that wraps around other code to give it a nicer, simpler, or different interface — like putting a phone case on a phone.