Common question for .NET developers deciding to venture into Ruby are: Where do I start? What should I learn first: Ruby or Rails? What do I need installed? What are the best resources to get started? Where do I find more in-depth information?
In this post I’ll answer each one of those questions. However, keep in mind that this is solely based on my own experiences; what worked well for me may not work well for you (well, that should be said for every single blog post out there, right?).
Do I Learn Ruby or Rails First?
After Putting Ruby, Rails, C#, and ASP.NET in context, the first question that may come to mind is: should I learn Ruby (the language) first, or should I learn Rails (the framework) first?
I think most people would think “well, you must learn the language before you learn the framework…”. Even though several people indeed prefer to learn Ruby first, Rails does make it so that you can get quite a bit done without knowing a whole lot of Ruby. That was the route I took.
Ruby is not that different from the most popular languages out there, so if we’ve had experience writing software before, we can kind of guess what the following code does:
if some_condition variable = some_value end
We wouldn’t have problem guessing even if the code was written more in the “Ruby Way”:
variable = some_value if some_condition
One of the advantages of starting with Rails is the immediate reward of seeing a working application. If you start learning Ruby first instead, then you’re rewarded with the comprehension of language syntax and constructs… I don’t know about you, but the latter sounds kind of boring to me.
With that said, one of the disadvantages of that approach is that Rails performs a lot of “black magic” in order to get stuff done. That does bother people who want to be in control of everything, but it doesn’t bother me; I’d rather see things getting done, even though I don’t fully understand it. Afterwhich, I learn the spells as I get more experienced with the way of doing things in Rails.
What do I need installed?
If you go down the same route of learning Rails first, and I’m assuming you’ll be running a Windows machine, the best way to get the things you need installed is by visiting RailsInstaller.org. Download and install the RailsInstaller, which includes the things you’ll absolutely need (such as Ruby, Rails, and Bundler), as well as a couple more things you’ll likely end up using (such as Git and Sqlite).
While you’re at the RailsInstaller.org site, I recommend you take the time to watch the video in their “step 2” instruction; it walks you through the installation process, as well as creating your first Rails application (and deploying it to Engine Yard!) in order to make sure everything works well.
It’s a Command-Line World!
In the Ruby and Rails camp, pretty much everybody spends a lot of time in the command-line, creating projects, generating controllers and models, running tests, etc. I’d recommend you use PowerShell, instead of the old DOS Command Prompt (even when doing only .NET I had gotten used to using PowerShell for several things… it is a lot faster than any IDE, and I’m yet to see it freeze or crash on me). I also recommend you try out Console2 so you can get a nice tabbed-interface.
We Edit Text Files!
When we’re building .NET applications, we’ve very likely editing text files. Even when we’re using the so-called “designers” (dragging and dropping our way to conquer the world), at the end of the day we’re creating text files (xml, xaml, html, you name it).
In the Rails camp, nobody really cares about fancy designer tools; things get gone by editing text files directly. When I started with Rails, I’ve made a point to myself to use Notepad (actually, Notepad2) for a couple of weeks, because I wanted to see what exactly I’d miss from my “Visual Studio overdosed with add-ons” (I’m one of those few freaks who use both CodeRush and Resharper at the same time).
After a couple of weeks, I figured I missed things such as refactoring tools, auto-completion in certain scenarios, easy navigation through files and classes, so I decided to give [RubyMine] a try, and that’s what I’ve been using since then.
I have also started to learn Vim, as it fits well my keyboard-centric way. However, it has a steep learning curve, so I’m getting into it in small doses.
“But I want my Visual Studio awesomeness!”, I can almost hear you cry. If you use Resharper in Visual Studio, you’ll probably feel right at home with RubyMine. If you do indeed feel like what you want is Visual Studio, you may want to try Ruby in Steel; I haven’t personally tried it, so I can’t share any experiences with it. Honestly, since software development is mostly all about editing text, I don’t want to fire up such a heavy and bloated tool as Visual Studio.
Resources for Learning
Tutorials, articles, blogs, books, podcasts, webcasts… there’s a lot of material available for you to learn Rails. Here are some of the ones that have been very useful for me:
Rails for Zombies: I take humorous and wacky ways to learn technical things over boring literature any day. Rails for Zombies is a cool way to learn some of the basics parts of a Rails app. On each level, it has a short video that explains the part being covered, and then it takes you to a hands-on lab, where you can try things yourself, right within your web browser, without a need to install anything. There’s also a downloadable PDF file containing the slides presented in the course; I’ve shoved that file into Evernote, as I keep going back to it when I need to remember some syntax or whatever…
Rails Tutorial: Here you’ll find an entire book that teaches you Rails, as well as a screencast of the content (14 hours of great material!). I got the bundle (e-book plus screencasts), and went through the whole thing, following along every step of the way. I’ve learned quite a bit from this one…
Rails 3 In Action: great book!
Virtual Brown Bag: Free weekly where people get together to share a bunch of tips. Over the last several months, most of the things shared have something to do with Rails (yours truly happens to do quite a bit of the sharing over there, too!).
Hopefully, you’ve also been following our Switching to Ruby from .NET series, which already contains quite a bit of a material, and you can expect a lot more to come.
Again, there’s a lot of material out there, and I’ve mentioned some of the ones that have helped me. I’d recommend that once you’re done watching the afore mentioned video on RailsInstaller, the next stop should probably be the Ruby on Rails Guides, which covers all the core things you need to know about Rails. Those should keep you busy for a little while.
Getting More In-Depth
I have been writing several posts for my personal blog over the last couple of months, documenting my experiences learning Rails. I’m also keeping a shared note with resources that have been (or still are) helpful to me. Make sure to check those out!
Nothing beats getting your hands dirty!
I read lots of books, articles, blogs, watch lots of videos, talk to people way smarter than me… but none of that beats getting my hands dirty and actually building applications with Rails. Just think up of a simple application, and commit to writing it in Rails. That’s what I did, and it has been working out great. Whenever I get stuck, I post questions on StackOverflow, the #RubyOnRails IRC room on freenode.net, or bug my Rails buddies. :)