1. Computing
Michael Morin

Is the Ruby Stdlib a Ghetto, or Isn't it?

By November 27, 2010

Follow me on:

Recently, Mike Perham wrote that the Ruby standard library is "old and crufty."  By this, he means much of the code in the library hasn't been touched since 2003 or so, doesn't look like modern Ruby code, performs badly and has poorly designed APIs.  He may have a point, that in order for progress to be made, code must be revised, rewritten and refactored.  But on the other hand, everything relies on the standard library, so you can see why the Ruby devs may be cautious when it comes to touching these libraries (but that's nothing test-driven development and a lot of work can't fix).  Perham also argues that many libraries that are now included with the Ruby standard library should be moved into gems.  For example, when was the last time you used REXML?  Many don't use it at all, preferring the much faster and familiar Nokogiri or Hpricot.

But Perham's statement wasn't without controversy.  Eric Hodel replied with "Mike presents only the thinnest of arguments."  Hodel goes on to break down each of the libraries that Perham focused on, and makes some pretty good points.

But it's not over yet.  Perham as replied, fleshing out his argument some more.

These blog posts are good reads, and I think they both make valid points.  It would be nice to completely overhaul the standard library every so often, but you risk fracturing the Ruby community by doing so.  Ruby 1.8 to 1.9 was a relative small jump, even if modifications to C extensions were necessary.  There was a period of disjointedness but that seems to be resolved now.  But, on the other hand, if this gap is too wide to be bridged, there can be problems.  When PHP 5 was released, no one would use it.  Their codebases were too large and it couldn't run PHP 4 code without modifications.  A more modern example, Python 3000 was released but Python 2 is still in wider use because of incompatibilities.  So the question is this:  If the standard library needs to be revised, do you bite the bullet do it all at once, or a process spanning years?  In other words, do you pull a band-aid slowly, or quickly?

No comments yet. Leave a Comment
Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.