Why you should open-source your (useful) projects


This week I finally got around to cleaning up the EncodingSampler gem, mentioned previously on this site, and publishing it here as encoding_sampler at Rubygems.

It’s amazing how simple it is to publish and use open source software these days.  Creating an account a Rubygems.org takes just a username, an email address and a password.  Easy.  Creating the Gem and actually publishing it took about 20 minutes, most of which was spent RTFM’ing because I didn’t believe it would be as easy as they said (and it was) and trying to make sure I understood what the results were going to be like.

The only thing that really took any significant time was work on the code and documentation to avoid embarrassment of publishing something inconsistent with community quality standards in two obvious areas: testing and documentation.  Which brings up my top 10 5 reasons it’s a good idea to publish useful projects publicly.

  1. Someone might find it useful – a.k.a “giving back.  If you are a programmer at any level, odds are you have benefitted from software others have basically donated to the community.
  2. Public accountability – It makes you do a better job.  Or at least a different job. For example I think people expect publicly released gems to be reasonably well tested.  So before pushing to Rubygems, I added a few tests that I’d been to lazy to implement originally. Also good docs are a requirement if you expect anyone to take a gem seriously or find it helpful.  So I cleaned up the docs and wound up using YARD for the first time.  Not sure I would have done all this for internal use when everything already works OK.
  3. Implicit code review – Most of the time I work in a home office and the closest thing to pair programming that happens here  is when both cats are trying to walk on the keyboard at once.  I’d never push up something I didn’t think was solid code (we’re using it in a key project already,) but nothing like user comments, complaints, pull requests, forks, etc, resulting in…
  4. Better ideas – Maybe the encoding sampler concept is crap.  If so maybe someone will mention somewhere that EncodingSampler is a dumb way to do this.  Or maybe the form of the solution is OK but the implementation stinks, and maybe someone will do better.
  5. And of course, Fame and Fortune.  37Signals or ThoughtBot or Pivotal or ??? is bound to see this code and try to hire me, right?  Not likely, but having some code out there does lends some credence to the claim about being a gen-u-ine professional software developer.

So far the only tangible benefit, besides learning a bunch of new stuff is that I got to remove an ugly Github url from the Gemfile in another referring project.  Well we will see…