This post was first written for my website – you can find the original post here.
We’ve talked about open-sourcing some of our tools for a while, but talking and doing are different things. Having a small team developing an awesome service means we’re constantly busy and behind on many of our tasks, making it difficult to dedicate time for things that seem “less valuable”. As a result, I decided to set aside some time in the last few weeks to do this project and just get it done.
Here are few scattered thoughts around open sourcing our Segmented Control widget.
Where To Start
Creating an open source project can be very overwhelming, or at least it was for me.
You start worrying about if people will like it, use it, improve it; whether the company will appreciate it, support it, and develop it. Then you bring other projects into your thoughts and how they have beautiful landing pages and thorough documentation, an incredible automated test suite, contributors, and a community. You then wonder whether your project will be good enough to be open source and that doubt translates into postponing or even dropping the whole thing.
Needless to say this train of thought takes you nowhere.
With that in mind, we decided to start small. Like really small. I took it upon myself to prepare for open source primetime a jQuery UI widget that we’ve been using on Expensify’s web application for a year and change that is very small, very simple, very clean, and works very well.
And So It Began
As previously mentioned, the project is called Segmented Control. It is a UI control for the web that works similar to radio buttons in the sense that it allows users to select one value out of a (usually small) set of values. A project page is worth a thousand words, check it out.
I started with a quick cleanup of the code that included fixing some whitespace, removing underscore as a dependency, and adding some validation.
Then came the tests, and with it came setting up the repo with the JS dependencies, researching mocha, chai, npm, and bower.
I decided I didn’t want to run the test in the browser, which unveiled the trickiest part with relation to the automated tests: how to write tests for a jQuery UI widget that can run using node. Luckily, I stumbled into this Protip on Coderwall and learned about how
jsdom could be used to create the widget, emulate clicks on the control, etc.
Finally, I created the project page, pushed it to Github and released it to the world.
Before You Go
This was a very interesting exercise, regardless of how small the project was. I found many challenges along the way, one of which was documenting the process in a blog post. I hope this first small step will pave the way for more involvement from Expensify in the open source community, and encourage a wider group of candidates to join our team.
I’d like to encourage everyone that has thought about open sourcing a piece of software, but found it overwhelming, to start, even with a very small project like ours.
Lastly, I’d also like to give a quick shout-out to Giorgio, the original developer of the widget.
Interested in learning more about us or getting involved in the open source project? Drop us a line!