Do you know the twiddle wakka? It looks like this:
You’ve seen it in your Gemfile. Here’s an example
Gem “rails”, “~> 3.0.3”
Gem “thin”, “~> 1.1”
~> 3.0.3 means that when you bundle install, you’ll get the highest-released gem version of rails between the range >= 3.0.3 and < 3.1.
~> 1.1 means that when you bundle install, you’ll get the highest-released gem version of thin between the range >= 1.1 and < 1.2.
I learned the name “twiddle wakka” at Jeremy Hinegardner’s Rubyconf 2010 talk, Anthropology of Ruby. During a data-driven analysis of the ecosystem of Rubygems, he found the twiddle wakka is used infrequently and asked the Ruby community to use it more.
Using the twiddle wakka in combination with consistent MAJOR. MINOR. PATCH versioning by gem authors, we can achieve better stability in our dependencies. Jeremy suggested reading two documents on consistent versioning:
Apache’s version numbering
In the comments of this post, David Chelimsky suggested a related document that is particularly relevant to us as Rubyists:
Rubygems Rational Versioning
I think most people are in favor of this in principle but are not consistent in practice. This leads to confusion: “Which libraries are consistent and which aren’t? Is this gem safe to declare as a dependency at the major, minor, or patch level?”
It seems like a simple way of clearing up the confusion is for authors to declare their intention of consistent versioning by using the twiddle wakka in their README’s installation instructions. If I see this…
Gem “clearance”, “~> 0.9”
… then, I feel the author is assuring me of the “safety” of this gem at the minor level.
Therefore, I’m editing the READMEs of our gems to declare our intention. Some may be “twiddle wakka’ed” at the major level, others at the minor level, and others at the patch level. That seems like a reasonable compromise to me since every project is at a different stage.
I’ve been guilty of being inconsistent about this in the past. Call it a New Year’s resolution, but I’d like be better about it in 2011.
What do you think? Is this README idea any good? Are you going to do the same?