Always consider Open Source - sahajss/knowledge_base GitHub Wiki
As of this blog post, there's over 2 MILLION Github repositories and hundreds of thousands of open-source projects on the web. At this point, there's an open-source library for almost anything: iOS notifications in Javascript, Lorem Ipsum quotes from Samuel L Jackson, and even random placeholder pictures of kittens. Open-source libraries connect APIs to platforms, make it easier to implement a feature, or just make your code a little faster and cleaner. Package managers like npm or brew make it easy and fast to use external libraries – so if someone else has already done the work and offered to share it with you, why not take advantage of it?
I learned this lesson as I was developing my app using the Plaid API to let users log into their bank accounts. I spent weeks and weeks working on the basic login flow, but there were so many edge cases and weird quirks (two-factor auth, password resets, working with hundreds of bank logos) that it was taking forever. Soon, however, I stumbled upon plaid-ios-link, a native Objective-C library that had already done exactly what I was trying to do.
With a few hours of work, authentication was up and working: this open-source project had saved me more than a month of effort. Beyond saving time, however, open-source has other advantages: it often has fewer bugs (because more people can look at it and fix potential issues) and is usually more secure than self-written code.
Since open-source is so great, you might wonder why the title of this blog post is "Always consider Open Source" and not "Always use Open Source". Just like any other architecture decision, using open-source libraries is a decision with benefits and trade-offs. Using tons of libraries can slow your webpages or compile times, and sometimes makes it harder to learn the codebase for other project members. As you're considering whether to use a library or not, here's a few questions to ask yourself:
- Would this library save me a significant amount of time?
- Is this library exactly what I need, or does it have tons of features I won't use?
- Is this library well-documented and easy to use? (Could a new team member sit down with the code and easily figure it out?)
- Will this library impact the performance of my application?
Finally, if you decide to use an open-source library, you should consider giving back and helping contribute to it. The open-source ecosystem only works when developers volunteer their time to fix a bug or improve documentation, so if you benefit from a project you should consider helping it get even better. If you don't know how to get started, try looking at Github's guide, Contributing to Open Source on GitHub.