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 a…


This content originally appeared on DEV Community and was authored by Matthew Waddell

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.


This content originally appeared on DEV Community and was authored by Matthew Waddell


Print Share Comment Cite Upload Translate Updates
APA

Matthew Waddell | Sciencx (2024-07-18T03:34:01+00:00) Shims in Web Development. Retrieved from https://www.scien.cx/2024/07/18/shims-in-web-development/

MLA
" » Shims in Web Development." Matthew Waddell | Sciencx - Thursday July 18, 2024, https://www.scien.cx/2024/07/18/shims-in-web-development/
HARVARD
Matthew Waddell | Sciencx Thursday July 18, 2024 » Shims in Web Development., viewed ,<https://www.scien.cx/2024/07/18/shims-in-web-development/>
VANCOUVER
Matthew Waddell | Sciencx - » Shims in Web Development. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/18/shims-in-web-development/
CHICAGO
" » Shims in Web Development." Matthew Waddell | Sciencx - Accessed . https://www.scien.cx/2024/07/18/shims-in-web-development/
IEEE
" » Shims in Web Development." Matthew Waddell | Sciencx [Online]. Available: https://www.scien.cx/2024/07/18/shims-in-web-development/. [Accessed: ]
rf:citation
» Shims in Web Development | Matthew Waddell | Sciencx | https://www.scien.cx/2024/07/18/shims-in-web-development/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.