According to Wikipedia, “Open-source software is a type of computer software in which source code is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software to anyone and for any purpose. Open-source software may be developed in a collaborative public manner. Open-source software is a prominent example of open collaboration.”
Many developers around the world use open-source software in their projects. There is often a need to include some sort of special functionality in your project which would otherwise take a lot of time, effort and resources to implement, test and maintain. Open source to the rescue. Developers go to GitHub, explore npm repositories, etc. to find a solution that would suit their needs. Think about the power of community behind each open source project – a lot of contributors maintain packages, file bugs and resolve them, add and test new features. It would be impossible to achieve such results by yourself. It is invaluable that we can freely take and use these solutions in our projects. But what about giving back?
I have been one of those developers who used open source software in their projects but I never gave back. The typical reason by most developers give for not contributing to open source projects is a lack of time. Recently I had an opportunity to break that habit and am going to share my experience with you.
I needed to implement a custom behaviour in a project I’m currently working on. For many UI components in the app I used the same open source library, however the library did not have the ability to get multiple suggestions from a typeahead (a.k.a. autocomplete) control. Typeahead controls usually provide a single list of suggestions based on the user input. As soon as you pick a suggestion, you are done. I needed to be able to continue to generate suggestions indefinitely after entering a delimiter, like space or comma. I had a couple of options: implement and test a whole new typeahead control with the required functionality myself or add that functionality on top of the existing control from the open source library. I discussed it with my client, got their approval and went ahead and made my contribution to the open source project. Now that functionality not only helps me but also other people who may need it in their projects. Also, with the power of community, it is going to be maintained, possible bugs fixed, improvements added. You see my point.
This approach does come with some drawbacks. What if you need that functionality now and your deadlines don’t allow you to wait for the project’s maintainers to approve your contribution? What if your solution is not even accepted? It is important to follow rules of the project’s maintainer to increase chances of acceptance. In my case I followed all the rules: I implemented the new feature, wrote a few unit tests to cover it, ran all tests to make sure nothing breaks and added documentation with an explanation of how to use the new feature. But maintainers are often volunteers and their priorities are not always in line with yours. If you can’t wait for the approval process to happen on its own timeline, you can go with patching. There is a great blogpost done by my colleague, Rod Nolan, talking about patching of npm modules and you can find it here.
The existence of open source software is a wonderful thing in the world of software development. It helps us to build much better and more complex solutions in a shorter period of time without going into implementation details of a specific problem. We should come forward and do our part whenever possible. Next time, when there is a need to have a specific functionality that you can’t find in an open source package your project depends on, think about contributing your solution to the open source package so that others may benefit from your work. Or, if you have time, choose any project of your interest and fix a bug or add a new useful feature. I hope the experience I shared in this post convinces you consider contributing to open source software. It’s a fairly easy way to make a positive contribution to the community that you rely upon.