The Ruby Stdlib is a Ghetto
mikeperham.com
mikeperham.com
If you got "brainwashed" in the last 5 years about code quality (DRY etc.) + test methods (TDD/BDD) and then look at today's Stdlib, you'll scream and want to put bleach into your eyes…
To me it seems the "übercool" guys already moved away to their NoSQL/node.js/whatever next party, so it's not easy to motivate people to change such "messy" and large projects anymore.
I'm also not sure about the number of Ruby interpreters around and their useful impact: If you e.g. change something for Ruby 1.9.x / 2.0.0, it will cost a lot of manpower to port those changes to JRuby, Rubinius, maglev, IronRuby and BlueRuby (if SAP's Ruby is still alive?) and most of them are just used by very few people.
Maybe resources are better spent in creating a new Stdlib, improve the rubygems infrastructure (already started with gemcutter) and do something with RAA?
Would you agree?
A horrible Stdlib is imho a more important problem today.
But I knew already that "rubyspec" wasn't a spec in the ordinary sense but a test-suit built with MSpec.
The thing is that real spec actually fully specifies a language - at least up to syntax. There are real specs for Python and Java for instance. The only real spec for Ruby is still crufty Yacc code for MRI.
A test suit doesn't do that and the whole Rubyspec thing is a testimony to people drinking too much of the Test Driven Development Cool Aid. TDD may be fine for some things but some formal design is needed for things like the creation of interpreters.
Part of the challenge is that MRI has such a fluid syntax that specifying it conventionally would be quite hard. But I suspect that's what will have to happen if Ruby's going to go forward.
Maybe Python has lousy spec but as I recall, the documentation does include a BNF breakdown of what Python is.
A test suite can be good for a lot of things BUT it cannot be a specification, it cannot be even sort-of a specification. Test suites only "prove a negative", only prove that an application won't do X. A specification is at least a rough assertion of a positive, that a language does follow this pattern.
Java specifies the semantics of Java and the JVM remarkably fully. Python, not so much.
see the slides of my recent talk about it:
RAA has been obsolete since RubyForge (which was subsequently succeeded by Gems and Github), I am not sure why you would even bring it up.
The MRI development process is very conservative, yes, but that is offset by the very dynamic development processes of Rubinius and JRuby (even if in part driven by the conservativeness). There are few things in the language itself that need change, and those are to be resolved for 2.0. The main development cost is in actually setting forth the changes, not in implementing them.
The Stdlib sucks, sure, even if some of the libraries are better-maintained than others. Better alternates can be installed via Gems in almost all cases. There is an ongoing proposal to gemify the rest of the Stdlib (some parts are needed just to support Gems itself) mainly to reduce the distribution size and there are some arguments back and forth. By and large, however, it is pretty irrelevant to day-to-day life with Ruby.
In the meanwhile, if you are serious about the problem: spend your own resources to adopt one of the stdlibs and update it as necessary. This is open source, and that is how problems get solved.
Edit: removed tautology in 4th paragraph.
On the other hand, there has been some progress. It's good to see MiniTest replace Test::Unit (while also remaining mostly backwards compatible).
Actually, 1.9.2 ships with replacements where possible: for example, CSV is now FasterCSV with a compatibility interface, Psych can be used instead of Syck for YAML parsing.
I guess it's a mixed blessing if your library becomes part of stlib. On the one hand, it's gotta feel great to have so many people using your code. But on the other, your release cycle is pegged to Ruby's.
I'm still searching for a good Net::HTTP replacement that runs on both MRI and JRuby.
* put the existing stdlib into a legacy gem
* create a new stdlib with a new, good, (incompatible) API from scratch
* deal with the incompatibilities that will happen
I agree, deprecate and replace is the way to go. That's what I'm doing with Psych and with Fiddle. I really like this option because I don't want to break people's code.
There is a downside though. I've tried shoehorning the REXML api on top of Nokogiri. The problem is that doing that work is thankless and not very fun. The API for REXML is just too large, and the deviations between the way it works and how libxml2 works are too many.
I think if we add new libraries, and encourage people to move to the new ones, then start removing the old ones, that would be best.
[0] http://thelincolnshirepoacher.com/pages/standard-librariesIMHO, with a lib sharing system such as rubygems, having a standard set of "external" libs in kind of unnecessary.
And if you still think that's hyperbole, it's an allusion to Zed Shaw's infamous "Rails Is A Ghetto" post.
Much of Ruby’s standard library (the set of classes shipped with the Ruby VM itself) is old and crufty. For laughs, go look at the code for some of the classes that you’ve never used. Chances are it’s from 2000-2003 and doesn’t even look like idiomatic Ruby. I’m wondering what classes should be removed from the standard library or deprecated so that higher quality replacements can take their place.
The canonical example is Ruby’s net/http library. Its performance and API are just terrible. (Side note: how do you know if an API is terrible? If you have to consult the docs even after having used the API for the past 5 years.) But because it’s in the standard library, most people use it as the base for higher-level API abstractions (e.g. httparty, rest-client).
So looking at Ruby’s core RDoc, my suggested list for removal (where removal means move to a rubygem):
Net::* DRb REXML RSS Rinda WEBrick XML
Any others I missed? Will Ruby 1.9.3 or 2.0 get a good spring cleaning or will we have to live with these classes forever?
I feel like it is risky to commit to using Ruby for the long-term.
If you like Python, I don't know why you'd even think about "committing to Ruby for the long term"; you're a Python dev. They're practically the same language. Stop trying to pick fights.
popen, popen2 - both deprecated. The new "proper" one is available since 2.4 (quite a long time now) - subprocess.
> How many different ways to get the current time?
time.time() <- timestamp, datetime.now() <- date
Is this that bad? Sure, popen and popen2 are silly, but they're left for compatibility, while subprocess was introduced to update stdlib (as OP claimed). It's hardly a jungle...
We can sit here and ping each other with examples of cruft all day. I think it can be shown objectively that Python's standard library is better maintained. I'll attempt to below.
I'm not saying this has a great significance in picking one language over the other in and of itself. Just that if you want to talk specifically about stdlibs, the differences are pretty clear-cut imo.
== In terms of quantity of updates ==
- Mar 13 2007: Ruby 1.8.6 launched
- May 18 2008: Ruby 1.8.7 launched
- Distance: ~14 months
- Sep 19 2006 Python 2.5 launched
- Oct 18 2008 Python 2.6 launched
- Distance: ~23 months
So discount the amount of 2.5->2.6 changes accordingly to account for the extra time.
Then compare stdlib changes:
- Ruby: http://svn.ruby-lang.org/repos/ruby/tags/v1_8_7/NEWS
- Python: http://docs.python.org/whatsnew/2.6.html#new-and-improved-mo... or http://www.python.org/download/releases/2.6.1/NEWS.txt
== In terms of quality of documentation ==
Compare
http://www.rubydoc.info/docs/ruby-stdlib to http://docs.python.org/library/
You'd need to compare across actual libraries (unittest vs Test/Unit etc). I didn't provide specific examples in links to avoid inevitable accusations of cherry-picking.
== In terms of process ==
Compare http://www.python.org/dev/peps/pep-3108/ to... closest equivalent I could find was http://redmine.ruby-lang.org/projects/roadmap/ruby-19 . Anyone with a better link?