Waaaay back when (yes, it was eight years ago, an eternity in software development), I wrote a post on my old blog about using “Code from the Internet”. In those days, for me and my readers that meant finding some C# code from some blog post somewhere out there written by some Joe Blow and using it in your own app. These days however, if you’re doing any kind of web development, you’re going to be pretty well using a whole bunch of code from the internet, and in general from that internet outpost called GitHub.
Back then, my recommendation was to read and understand the code you were about to, er, recycle, and to sanitize it, if you felt that was needed. This is exactly what I did with the server code behind the URL shortener I use for jmbk.nl: read it to understand it, clean it up, remove the bits I didn’t want, add new stuff I did, rename the API identifiers, make it work on Azure, add authentication, and so on. After all, it was first written in 2009.
These days, with jQuery, Angular, Knockout, React, etc, etc, you just do not have the time, resources, or inclination to do a deep dive. Instead you rely on what might be called a crowd effect: if lots of developers are discussing and using and maintaining some library you’re about to consider, then you’re more likely to view that code as a black box that can be used as is without too much worry.
This attitude came back to bite me last weekend as I updated that old blog to use a modern responsive theme instead of the wickedly awful theme I’d concocted for myself some ten years ago (“to make the website look good in both Firefox and IE6”). Like all modern themes, the look and feel is pretty much all generated from the CSS but there’s also some tweaks to improve the experience via some JavaScript. The theme ships with about a dozen open-source libraries, some of which I’d never seen before (and that I might use elsewhere). To cut a long story short: the theme couldn’t find images that were definitely available. The culprit was one of the JavaScript libraries that was also being loaded (and whose purpose was something completely different).
So what to do? Especially given the reality properly exposed by the now old joke “If you don’t like the JavaScript library you’re using today, there’ll be another along in a minute”.
I’d espouse a few tactics:
Above all, remember that most open source libraries are, well, ahem, crap. They’re uploaded once and never touched again. And note I count some of my own open source libraries among that illustrious set.
Open source libraries (or to use my old term, code from the internet) are a great way to expand the capabilities of your apps, especially client-side. But be aware that just because they’re “free” doesn’t mean that the cost to use them is zero.
No Responses
Feel free to add a comment...
Leave a response
Note: some MarkDown is allowed, but HTML is not. Expand to show what's available.
_emphasis_
**strong**
[text](url)
`IEnumerable`
* an item
1. an item
> Now is the time...
Preview of response