Thursday, June 15, 2006

Memorizing Ruby

I've never been a professional programmer. I hack in my off time and occasionally do some programming in support of my day job. I've worked with a lot of programmers though, and I often pick up ideas from them, or see them exercising skills in ways I want to emulate. Recently, I've seen something else I want to do.

We just hired a programmer here at work. He's a bit new to Ruby, but he's already hard at work turning out some system monitoring and recovery scripts or us. One of the things He's doing is memorizing the Ruby core classes. Both what classes are available and the methods and their signatures.

I've never worked like that. I just use the language, looking up what I need to, until parts of it become second nature to me. That leaves me with some pretty incomplete coverage. To make matters worse, If I don't keep using the knowledge I've gained, I'll forget it.

Memorizing these classes and methods doesn't seem like a bg investment, but I can already see the dividends it's paying off for him. I guess it's time to whip up some flash cards and get to work.

6 comments:

Anonymous said...

here are pictures of te hierarchy (in the OP and comments)

http://www.rubyinside.com/diagrams-of-rubys-class-hierarchies-48.html#comments

Anonymous said...

Sorry, let me try again


relevant (I hope) pictures of hierarchy)

Hans Fugal said...

Good for him, but memorizing isn't the best way to learn for everyone. Think about how you best learn and apply that. In my case, it would be reading/skimming through the standard library documentation, so I know what is there. Then when I need it my brain will remember that there was something that could do it, and I just have to go find it. With ri and ruby-doc.org this is not hard to do.

pate said...

Anonymous, thanks for the link. Having a structure around the memorization is always a good idea.

Hans, that's good advice. I find that a single read through might or might not help me remember (especially at the level of detail I'm looking for). I'm interested in seeing how much memorizing (or trying to memorize) will help.

Is it for everyone? Probably not. Is it worth trying for me? Absolutely.

Levi said...

What I find really useful for me when learning a new language or just trying to improve my skills with ones I know is not to read language specs but to read code.

Manuals and class diagrams aren't nearly as good at expressing how things are actually used as real code is. When reading code, you pick up idioms and patterns that you just can't get any other way.

Anyway, this is certainly not to discourage you from memorizing class hierarchies, since that would doubtlessly improve your programming facility. It's no substitute for reading good code, though.

pate said...

Levi,

Great point! Code reading (and writing) are huge parts of learning to program proficiently. What Ruby code have you read recently?