3 ms·
This is generally great advice, but the Ruby standard library isn't exactly the best to read if you want to learn. Don't get me wrong, it works, but the code is
by steveklabnik 13y ago
This is generally great advice, but the Ruby standard library isn't exactly the best to read if you want to learn. Don't get me wrong, it works, but the code is generally very, very old. Nobody knew how to write good Ruby code back then.
- bcjordan 13y agoAh, will certainly trust your assessment there. :) In your opinion, what are some good starting points for interested Ruby readers ?
- steveklabnik 13y agoI tend to point people at "Eloquent Ruby" to learn how to write idiomatic Ruby code, rather than point them at actual projects.
- haukur 13y agoFunnily enough, the first chapter recommends the standard library as idiomatic Ruby code.
- steveklabnik 13y agoHehe. And it comes full circle. It is a few years old... I don't think the social norms of Ruby have changed all that much. To be clear, there are good and bad parts of the standard library, just like there is all code. But much of it is basically a time capsule.
- bradleyland 13y agoIf you're speaking of code reading, I find looking at the source code of Rubinius very interesting. Ruby has so much utility wrapped up in places like Enumerator, that you don't see a lot of examples of low-level data structure implementation in the wild. You could look at MRI Ruby, you'd be looking at a lot of C, which tells you a lot about how Ruby works, but doesn't show you much actual Ruby. That's where Rubinius is really great. You get to see how a smart team would implement Ruby... in Ruby. https://github.com/rubinius/rubinius https://github.com/rubinius/rubinius
- netghost 13y agoI have to second this, if you use Ruby at all, Rubinius is quite fascinating to read, even if you still use MRI on a day to day basis.
- mjbellantoni 13y agoI came here to write this comment!
- wasd 13y agoHow do you feel about the author's other book, Design Patterns in Ruby?
- steveklabnik 13y agoI have not read it.
- jurassic 13y agoI loved it. Beyond pure technical chops, Russ Olsen is a great writer which makes his books stand out to me from other programming books I've read. In Design Patterns in Ruby each chapter handles a different pattern with a simple example that's easy to understand. And at the end of each chapter Olsen points out where that pattern is used "in the wild" in popular ruby projects if you'd like to see a larger example.
- netghost 13y agoIt may not be the best place to learn current idioms, but it is still worthwhile if you want to really understand the tools you are using.
- yawboakye 13y agoIf it has not been rewritten using modern (good) Ruby style I guess it's still turning a perfect cartwheel. While reading Eloquent Ruby (by Russ Olsen) Ruby's set standard library was recommended for source reading. It was an awesome read! I think standard libraries are really good at demonstrating at least two things: the language's preferred coding style and implementation of data structures and algorithms using the language's primitives. For these 2 reasons, they're still worth reading, imo.