home

My Rails Journey - The Expected Speed Bumps

Jun 23, 2010

So after using Rails to write my blog, I decided to move onto a slightly more complicated project using Rails 3 and Mongo (via Mongoid). My plan is to move to progressively more complicated projects until things start to fee natural. I think my expectations are realistic, I know that despite all the productivity claims, it'll be slow going at first. In fact, I looked at Rails a few years back and have a good understanding of just how different everything (Ruby, Rails, the community, testing, ...) is.

Yesterday I ran into, what seems like, a bug in Mongoid. Attributes (what we call properties in .NET/Java, and in the Mongoid-world they aren't part of the persisted document) of an embedded document weren't behaving like I thought they should. It took me a while, but I eventually figured out that the instance when the attribute is assigned is different that the one which it reads from. What I actually think it happening is that Mongoid clones embedded documents, but only clones the fields that are persisted - not the attributes. I managed to get a failing spec which hopefully will allow someone else to fix the bug.

But there's the depressing thing - I can't actually fix the bug myself. The mongoid code is beyond my comprehension - it almost doesn't look like programming to me. In the scale of things, I'm a very average programmer. I don't pick up new languages nearly as quickly as some people do. If anything sets me apart from the vast sea of 9-5 programmers, its my enthusiam and desire for quality. Eventually I, like anyone else, can master Ruby - the difference is that I'm motivated, willing and have realistic expectations.

This certainly doesn't mean that you should avoid learning Ruby, or even that learning Ruby is difficult. I just believe that its different...and that my existing knowledge of programming and programming languages is, in many ways, a liability. Having reflection hovering at the surface of my mind simply gets in the way or mastering ruby.

Maybe I'm going about this the wrong way. Maybe I should pick up a Ruby book and try to really immerse myself into the language first. Maybe the challenge isn't as big as it seems, and I just need to understand some fundamental rubyism. Maybe I should stick to more mature frameworks (like ActiveRecord instead of Mongoid) and then not worry so much about ending knee deep in low level framework code - but that doesn't feel right to me.

Hopefully in the coming weeks I'll be able to share some clarity with you. Hopefully.