Finding a new way to learn Ruby on Rails
I'm about a week into my learning experience with Ruby on Rails and have encountered a few challenges and also found a couple of resources I'd like to share with you. As with most "as you go" experiences, these blog entries are a point in time picture of where I am so I haven't gotten all of this figured out just yet.
My model for learning
In recent years when I adopted a new language or development environment I would simply breeze through the documentation and especially the tutorials. I figured, what the hell, I'm a developer with over 25 years of programming experience. I'm well versed in object oriented principles, design and coding practices, etc. This won't be hard!
The reality is by simply scanning over the tutorial information I was doing myself a disservice, learning a surface level knowledge of the development model. I would pay the price when I would start to do my actual application development work, making my mistakes in my real code. I also had a bad habit of only learning the areas of the language and development model that were appropriate for me. I nearly always had an idea for a product or application I wanted to build when I started my learning experience with new development tools and I focused all my energy on the areas where I thought I could use the tool set.
In this day and age of instant information and the easy accessibility of things like FAQs and solutions for technical problems, I want to take a more disciplined approach to learning both Ruby the language and Rails the framework. I think this should work really well for learning Ruby on Rails because the framework is so targeted. I don't have to weed through information that is specific to building client side applications or learning models that were designed to service both web and Windows based applications.
Applying this to Ruby on Rails
Learning from the Agile Web Development with Rails book has actually been coming along quite well so far. I decided to stay with Rails version 2.0.2 and just suck it up. At page 67 of the current version of the book the examples start to break down. What I did was break from the book at this point and started using Sean Lynch's excellent 2.0 tutorial, which uses the same application as the book except it's updated to work with 2.0. Once I finished Sean's tutorial I had the basics of the Depot application that is used in the book and have been able to follow along much more easily.
This has actually worked out really well for me because it has kept me fully engaged in the learning process. I'm still not completely comfortable with where code should fall in the Model-View-Controller system that Rails uses having come from the event driven code model in .Net; what's in the model and what's in the controller requires a little more thought on my part than I would like. My personal goal is to make that determination a no-brainer.
Learning Ruby vs. Learning Rails
One thing that threw me at first when coming into this technology fresh was what the difference was between Ruby and Rails. Well, Ruby is an object oriented language and Rails is a rapid application development framework that uses Ruby as the language. So do you have to learn Ruby to be truly proficient with Rails? You have to know the basics for Ruby in order to really absorb what's going on with Rails as you learn it, otherwise seeing :name, @name, @@name and just name are going to confuse the hell out of you. Class design in Rails is very easy and intuitive for me coming from a C++ / Object Pascal / C# background, though there are some very clear differences. It's the syntax that trips me up and at this point in the learning experience I'm doing a lot of "Oh, that's like... in C#".
When I bought my copy of Agile Development with Rails I bought the book everyone recommended to learn Ruby called Programming Ruby. Also referred to as the Pickaxe Book because of the picture of a Pickaxe on the cover, Dave Thomas does a nice job of walking the reader through the Ruby language. I decided that rather than go through the entire Ruby book first, I wanted to play with Rails at the same time to get excited about the environment. What I did was scan through the Ruby Tutorial in Appendix A of the Agile Development with Rails book to pick up the basics and then worked through the first 8 chapters of that book.
At this point I have a pretty good basic understanding of the Ruby language and syntax and more importantly a fairly functional application that gives me some hope that Ruby on Rails will be a good platform to build on. Now properly motivated I'm switching over to the Programming Ruby book to learn more about the Ruby language.
My goal at this point is to become proficient enough with Ruby that I start thinking inherently in that language, not translating mentally from a different language (in my case C#) and transferring that knowledge. Once I feel like I'm at that point - hopefully very soon - I'm picking the Agile book back up.