Shims in Web Development

shims-in-web-development

Introduction

In programming, a shim acts as a bridge between your code and an underlying system, allowing you to use features that might not be natively supported.

Web Shims

There was a time when certain JavaScript methods such as Array.prototype.includes were not readily supported in browsers even though production apps made use of it. To work around this issue, developers began to create scripts that patched in the implementations. The polyfill (shim) acted as a layer between the code and the browser’s native functionality. The polyfill provided a dynamic way to detect and address missing features, creating a consistent experience across browsers.

Polyfill Shim

Runtime Shims

As a rubyist, you will need to manage multiple ruby runtime versions on your development machine. You can install each binary manually or you can use a runtime version manager asdf. Asdf allows you to install and switch between different ruby interpreter versions easily. asdf installs the executables using plugins while also creating shims inside ~/.asdf/shims. Running the ruby executable results in running the shim instead. The version of the executable asdf uses is defined in ~/.tool-versions.

Summary

Shims are a handy technique in everyday programming that smooth out compatibility issues between your code and the environment it runs in.

Total
0
Shares
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
[jun]-ml-community — highlights-and-achievements

[Jun] ML Community — Highlights and Achievements

Next Post
the-new-workforce-expedition

The New Workforce Expedition

Related Posts