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.
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.
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
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.
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.
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.
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:
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.
Subscribe to my RSS feed and receive updates in your email!