Daily photograph for 2008-11-30 - "scooter park"

Today's photograph on my photoblog, "Photo-Persistence"

Ruby on Rails book review and cheatsheet

Along with many software coders, I’ve become a Ruby on Rails fan as well. I’ve had an interest in it for a while after reading so many websites talking about productivity gains. Its simplicity and speed of getting an application moving amazed me. Now I want to give back by helping to increase the RoR knowledge base by providing a Ruby On Rails cheatsheet.

When coding in Java, I’d get an idea in my head, start brainstorming about how it would work then I’d start setting up my work environment at home.

  • Create a new directory structure for the project.
  • I’m going to need logging - get the latest log4j jars.
  • Get JUnit for unit testing and include in project.
  • Get Hibernate for database persistence. Configure the hibernate files.
  • Get a templating project (Spring/Velocity/etc - take time to decide on which one) and add to project.
  • Do I want to use Struts for this too?
  • Assemble all the other jars I’ll need.
  • Setup a new project and configuration in my IDE.
  • Setup database connections and test that out.
  • Etc, etc, etc.

By the time I even start to write one line of code, it’s usually taken me until 2 evenings later, as I’ve got a day job and these ideas are meant as fun nighttime projects. By this point, the excitement of the idea is lost and the project gets shelved along with the others as something more important has usually come along or interrupted me enough to get in my way.

With Ruby On Rails, it’s a much different story. Within 5 minutes of sitting at my computer, I can be up and running with a complete environment, database configuration and blank template pages already showing me some results. Hours vs minutes makes a lot of difference. Just getting the project started is much faster, not to mention the amount of code required to do comparable tasks.

After trying out mostly all of the tutorials available on the internet, I ordered “Agile Web Development with Rails” from Chapters (Canada’s version of Barnes & Noble). I dug in, skipping to the appendix to review the Ruby syntax chapter so I’d understand the Rails code better. The book is a very easy read, written like a teacher is talking to you. I find this much easier to follow along than a heavily technical book. The book walks you through a tutorial as though you’ve been hired to create a storefront application for your customer who you consult with frequently (the Agile part of the book). And the tutorial gives you just enough information to keep you working along, rather than overloading you with everything on that subject in the chapter. If you want further in-depth knowledge of a subject, that comes in the next section of the book after the tutorial is completed.

I flew through the tutorial reading while commuting back and forth from work, then typing up the code when I arrived home at night. I stopped after the tutorial section, but haven’t jumped into the more in-depth content yet. I think I may review that section as I get stuck and need more information on a specific topic.

For now, I’m happy to try building some simple applications I’ve had floating around in my head for a while. And it won’t take me 8 hours before I type a single line of code.

Don’t get me wrong, I still really like Java and I know I will still use it (my day job is all Java based). There’s certain things I would choose Java for over Ruby on Rails and vice-versa. Use the right tool for the job. And now I have an extra tool in my toolbox.

Also, as part of my Ruby on Rails learning process I took a lot of notes (I’m a visual learner), so writing notes helps me to remember better, along with retyping out all the code in detail. Inspired by the PDF cheatsheets Amy Hoy produced, I’ve created my own set of notes and general cheatsheet as a reference to keep next to my desk when I need to jog my brain.

The document is at 14 pages so far and I’ll probably update it as I continue to learn more on RoR.
Continue on to download the Ruby On Rails cheatsheet.

Technorati Tags: , , , ,

10 Responses to “Ruby on Rails book review and cheatsheet”

  1. Davide Baroncelli Says:

    I don’t really get the “with rails in 5 minutes I have a basic app up and running”: what is the advantage with respect to things such as Equinox, Appfuse, or even the example apps of the major java frameworks? What about Rife? What about one of the jpetstores? Is having three or four templating choices so disturbing? I wonder why the majority of people keeps repeating that you should “use the right tool for the job” but then seem to be overwhelmed as soon as they have more than ONE technology to choose from.

  2. Damon Clinkscales Says:

    Nice cheatsheet! You should include script/console…a very useful tool indeed!

  3. Michael Bryne Says:

    Thanks very much for your cheatsheet!

  4. Amr Malik Says:

    thanks! this is great stuff!

  5. Daryl Richter Says:

    Thanks for the pdf, it’s well done.

  6. Markt Says:

    Nice photos.
    Sorry to hear of your loss.

    I’m having toruble printing your pdf on Linux boxen.
    Using Suse.

    I see it fine in AdobeReader.
    Printing or translating to .ps is trouble.

    ‘Spose I’ve got to go buy a(nother) Mac.
    My mac is good up to OS 9.

    Gotta save up for one of those DualCore Centrinos.
    Thattl probably run OS.X soon.

    Regs!

  7. Jeff Says:

    Excellent cheat sheet. It really boils down the basics of what a Ruby on Rails developer needs to know.

    I found a couple of typos:
    - In the “Testing” section you misspelled test: “…(example fest/fictures/users.yml”
    - In the “Control Structures” section you misspelled blocks: “…for single-line blogkcs …”

  8. Mitra Ardron Says:

    Hi - thanks for the cheatsheet. A minor typo - in “Exception handling” section the first line should be

    Without the “if” it generates an error.

  9. Michel Says:

    Hi!Thank you for your site.

  10. Shawn Adrian Says:

    Hi Blaine,

    I’m starting a blog / tutorials site geared about helping designers understand ruby / rails programming. Could I use and reference your cheatsheet on it? You’ve written some great stuff there.

    Cheers,

    Shawn

Leave a Reply