Why Sharing Code is Benevolent and Sustainable
Shared libraries offer quick access to solutions for common development problems. Incorporating shared libraries vetted by the developer community makes your entire codebase easier for other developers to understand and, ultimately, more sustainable. Why do the developers at Mightybyes use shared libraries whenever we can? It might have something to do with our dedication to sustainable web design.
Shared Libraries Mean You Do Less Work
How far along would society be if discoveries like a spherical earth or the tensile strength of steel had to be constantly rediscovered? Fortunately for society, we don’t have to rediscover either of these things: Someone has done the discovery work and shared it with us so that we can build skyscrapers and not fall off the earth when sailing west.
Using shared libraries can also mean that you do less development operations (DevOps) work. Using Bower to include libraries in your application means you can execute a single command to install a library to your codebase rather than find the URL, download the library, unpack it and move it to your codebase. Security updates to shared libraries are as easy as changing the URL from which the library is pulled or changing a version number in your Rails Gemfile or Bower’s component.js file.
On the sustainability side of things, common libraries are often cached in browsers, which means they don’t have to be called from another server at all. They are, in effect, the virtual equivalent of ‘buying local’. For more information on CDNs and sustainability, check out my post Server-Level Sustainability: Green Up Your Hosting.
The Sharing Community
Open source software is based on the principle of sharing knowledge. If you have to solve something with code, chances are that someone else will need to solve the same thing with code too. Consider sharing your solution with the developer community. Read up on how to correctly contribute to your language’s package repository and give back to the community whose work you are already using.
Also, making your code open source is similar to putting it out to hundreds of QA staffers at once. Developers can poke and prod the internals and, if supported, use Git to submit fixes or features for faster inclusion into the codebase.
Shared libraries are not only a great resource for fellow developers in the community, but a practice in sustainability. You are helping people not recreate the wheel and leading to a better development ecosystem for other people, which ultimately enriches the developer community overall.
Try the new Ecograder
Reduce digital emissions, improve performance, reach your website goals faster.Try Ecograder