Get paid to write open source23 Apr 2015
I feel bad. I've been wanting to contribute to open source for a long time. Almost everything I build is based on open source, Rails, Angular, countless gems and npm modules. Like many of us I have contributed very little to this ecosystem and have become increasingly troubled by my parasitic nature. Beyond a couple of dead-on-the-vine PRs into obscure libaries, I have contributed nothing.
I have my reasons dammit. We're all busy right? I have a full time job! I spend almost all of my development time working on private repo projects for clients. I come across a few issues in the libraries I use. I'd love to fix them but, they're paying the bills so I can't goof around in OSS and I certainly can't open source clients code, can I?
Then a bug came along. "Directions button does not load Google/Apple maps" said he. I did a bit of investigating, found that the directions link was using the
geo: URL scheme. It works fine on iPhone 6, but doesn't play so well with those ancient Android 4 devices.
So, no problem. We can keep using geo for newer devices then just fall back to Google maps... and Apple maps on iOS... oh and I suppose I should make sure it's not totally broken on Windows Phone. So I remove the url, add a pointer to a function which will parse the user agent and return the appropriate URL. I do a bit of digging, find a reliable regex to determine Android vs iOS, then a bit more digging finds me a way to get the Android version number so I can still return a geo: if it's supported... then I need to do the same for iOS... then I start thinking this is silly and someone must have done this before... but they haven't.
So I knock up a few tests for my new function with some sample user agents, start adding a load of code to my controller... add a bit more, start thinking this should be a separate service... move the tests into a separate suite for the service, import the service into my controller...
Then it dawns on me - I am just one layer of abstraction from this being a totally external library. So I took that last small step and Mapular was born.
And so began my first real steps into open source. What's more I put the hours in my timesheet without a pang of guilt, no goofing around required. My company still rightfully invoiced for my hours solving the bug. The Angular community doesn't have to go through all this user agent parsing ever again and the client gets their app updated with future user agents for free. Everyone wins.
It's just a mindset change.I kept thinking finding time for open source would mean a lifestyle change... or a company policy change... or a job change... but it really is just a mindset change. It took no longer to build this functionality as an external library than it would as a well tested internal peice of code but now it is available to all and potentialy self-maintaining.
Go do it. If you're writing decent, tested code chances are you are already doing everything you need to contribute to open source. So go make a repo and do it!