Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


It 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.


If 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.


Ah, will certainly trust your assessment there. :)

In your opinion, what are some good starting points for interested Ruby readers ?


If 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


I 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.


I tend to point people at "Eloquent Ruby" to learn how to write idiomatic Ruby code, rather than point them at actual projects.


Funnily enough, the first chapter recommends the standard library as idiomatic Ruby code.


Hehe. 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.


How do you feel about the author's other book, Design Patterns in Ruby?


I 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.


I have not read it.


I came here to write this comment!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: