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.