discover more
Latest Word

TUTORIALS, THOUGHTS and RAMBLINGS

Learning Ruby/Ruby on Rails: A Guide From A Fellow Nuby

2012 has been a transformative year for my career.  Back in May I heard about a new software training program called the Nashville Software School.  It’s a new innovative training program that teaches students the fundamentals of web application technologies in via classroom lectures, exercises, mentors and apprenticeship.  I got involved with the program by being a teacher for the front-end part of the school.  I was a student in the second half which taught us the fundamentals of web application development with Ruby on Rails and all of the associated technologies.  After going through the program, I’d like to share my tips on how to learn Ruby and Rails.  There is more that one way to learn but here’s what worked for me.

Prerequisites

  • HTML/CSS – You don’t need to be an expert but it’ll come in handy once you start working on views in Ruby on Rails
  • Unix Command Line – Again you don’t need to be an expert but you need to now how to navigate through directories, manipulate files and alter file permissions.
  • Text Editor – While you can certainly get started with a basic text editor like Notepad or TextEdit, starting out with a real editor like Sublime Text 2 or Textmate will make you more productive in the end.  These editors have features like syntax highlighting, code completion and snippets.  Plus they are extensible so that you can add features and customize them to your liking.

Learn Pure Ruby First

A lot of people come to Ruby by first going straight into Rails without first learning the core Ruby language.  I think this is a mistake and will slow you down when picking up the language.  If you jump right into Rails, it will be hard to decipher what is Rails and what is actually just Ruby.

I recommend picking up a beginner book such as Beginning Ruby and diving in.  That book in particular is focused on beginners so it only covers the fundamentals but it will get you going pretty quickly.

Also, there are several great online interactive learning programs you can do.  I recommend Ruby Monk, Ruby Koans and Codecademy.

Learn Basic Data Structures

Learning about the various data structures that are used in software development before diving into Rails will pay off.  One of the trickiest parts of building an app is deciding how it will work.  Knowing what data structures are out there and what the best practices for certain problems will allow you to architect better solutions.

Learn the primitive typs such as boolean, floats and enumerables.  Learn the more advanced data structures such as arrays, maps, linked-lists, binary trees and queues.

Once you think you’ve got the major data structures memorized, write a program for a linked-list.  Once you have that write a doubly-linked-list.  For more check out the Wikipedia article Data Structures

Version Control Is Your Friend

It happens to everyone.  You spend hours and hours writing some complex code.  Then your hard drive crashes or you accidentally delete a file.  All of that hard work is gone. But if you would have learned version control you could be back up running in a matter of minutes.

So learn Git and how to use Github as your remote repository for all of your code.  I recommend starting out by following along with the tutorial on Git+Immersion.  It’ll walk you through getting Git setup on your system and the basics of creating repos, recording or committing code, working with branches and recovering files.  The Git Book is another great read.

Finally, I’d like to point out that using Git and Github not only allow you to have version control but they also are a huge tool for collaborating with other developers.  They allow multiple devs to work on the same code and then later seamlessly merge them together with little effort.  Github is also the central place that open-source Ruby projects are managed.  Many of the tools and corresponding documentation that you’ll use once you get to Rails are hosted there.  Get comfortable with it now.

Test-Driven Development Makes You And Your App Better

Writing the tests for your code before writing the code itself might sound a little backwards but trust me, it’ll lead to better code.  By taking the time to lay out your tests you’ll be knocking out more than you realize.  Not only will the tests check your code to make sure it works like you intended but it will also force you into thinking through how you want it to work (something that devs often don’t fully do).  Often the process of writing the tests will help you simplify the problem and help you find easier solutions.  The biggest benefit of TDD is that you’ll gain confidence in your code.  Adding features to a large code base is no longer scary.  If you have tests, you’ll know of any bugs before you ship.

Rails ships with Test::Unit but most developers are using RSpec.  The official documentation is a good place to start.  Also many developers are using Cucumber to write behavior driven tests.

Learning TDD is hard.  It requires a mindset change for most people.  But from talking with lots of seasoned developers, it’s a battle worth waging.  Dig in and learn to love it.  Once you do you’ll never look back.  The confidence in your code that you gain is worth it.  Not to mention the money saved in not having to chase bugs.

Learn the Ruby on Rails Framework

Now that you’ve got the fundamentals of Ruby, version control and TDD down, you can jump into Rails.  Rails is a huge monolithic framework that can be intimidating at first.  But once you have the fundamentals of the software down, the details of various parts are easier to work out.

Here’s the order that I suggest you learn the main parts:

  1. Active Record Associations
  2. Rails Database Migrations
  3. Query Interface
  4. Action Controller
  5. Routing
  6. Views and Layouts
  7. Form Helpers
David Hartl’s free online book “Ruby on Rails Tutorial” is a great introduction to Rails.  It covers all of the basics without being to intimidating.  Next I recommend checking out the official Ruby on Rails Guides.  The guides layout the most basic features in a well thought out manner with lots of examples.  This proved to be my favorite resource for the basics.  Also, the official docs are well thought out and include everything you need.
Once you have those basics down, I suggest diving deeper by learning:
  1. Action Mailer
  2. Debugging
  3. Performance Testing
  4. Command line tools and rake tasks
  5. Security
Finally, as we discussed earlier it’s important to learn how to test Rails applications as you build them.  Rails ships with Test::Unit but most people also use RSpec for testing.  Some even go the extra step and use Cucumber to do integration testing.  I recommend following along with the tutorial in Rails 3 In Action.  The process that the author uses is TDD.  You’ll learn lots of ways of testing the different parts of the application.

Don’t Stop Learning

Just like most other technologies the feature-set and syntax of Ruby on Rails is continuously evolving.  It’s important to stay up to date with the latest techniques and features.  Here’s my recommendations where to look for new info.

  • Ruby Weekly - a free weekly newsletter with links to the newest articles around the web
  • Ruby Inside – the latest news and tutorials
  • Rails Casts - screencast tutorials. My single favorite resource.
  • Ruby-Toolbox - gem library with lots of useful information
  • Ruby Flow  – updated daily with every news story related to Ruby
  • Ruby Rogues - weekly podcast featuring some of the communities top developers

About the author

Adam Scott is a freelance designer, developer and online marketer that specializes in helping startup companies build their online presence.

Adam is available for freelance work, so hire him for your next project!

Enjoyed this post?

Subscribe to my RSS feed and receive updates in your email!

14 Responses to “Learning Ruby/Ruby on Rails: A Guide From A Fellow Nuby”

  1. sam452 says:

    100 percent agree, espeically the Ruby first. I had done the Hartl a year ago, but would beat my head against the wall when I encountered the 'no method' error. Also, it's Michael Hartl.

  2. Jaison says:

    Thanks for the valuable tips to learn ruby and it was very helpful for me. This article itself is a clear indication of the great knowledge that you possess and I wholeheartedly appreciate that brilliance. Thanks and best wishes for all future postings.free money 2012

  3. paraphrasing says:

    There have been significant changes in the way people use and access the web, and this has changed how sites are designed. algebra homework help

  4. ass says:

    In several prestige these statistics recommend that internal the setting of how we as a neighborhood ascertain repentance also chastity, it is considerably rush

  5. Helpful information. Lucky me I Discovered your site by accident, and I'm stunned why this coincidence did not took place in advance! I bookmarked it.

  6. Thanks for providing these tips. I will try these tricks practically.

  7. I am very glad to know about your post which is so informative about ruby on rails. I am looking to learn about ruby programming and your post is very useful in this case.

  8. For a successful health care marketing plan we should be more efficient on our health care practices; basically people are aware of about quality health care service as due to several health care frauds. So we have found a weak marketing structure for a health care plan therefore we need a strong marketing plan to develop the concept of health care.

  9. Smallwood says:

    Education is the important part of human life, and help peoples to get the financial stability. Education having the large importance that will helps to custom paper writing service gain sufficient academic qualification, and the great qualification willable to get suitable employment according to qualification.

  10. Umair says:

    It is nice to read your post and you giveonline fashion wonderful inforamtion. Please keep posting such kind of stuff.

  11. Pretty! This has been a really wonderful article.
    Thanks for providing this info.

  12. I read this post fully regarding the difference of hottest and earlier technologies, it’s remarkable
    article.

  13. I do agree with all of the ideas you have offered to your post. They are very convincing and will definitely work. Web designing is a huge platform where we showing our skills in better manner. Its a great opportunity for developers ,engineers,designers and whatever like that fields have done excellent job . I really enjoyed your post . Thanks for sharing and keep posting.

  14. thanks for this article, i like this

Leave a Reply

Copyright © 2011 Adam Scott. All rights reserved.