During the last six months it feels like at every Seattle.rb meeting we have someone who is brand new and asks “How do I learn to code?” or “How do I learn Ruby?”. After answering this question a 6+ times I figured I should write everything down so I wouldn’t forget things. I’ve broken this up into a series of blog posts, each with recommendations for different audiences.
With a couple exceptions I’ve tried every resource on this list trying to get a feel for the pedagogy, what is taught, and what types of people will be successful with the material.
Part 2a: Know How to Program But New to Ruby &
Part 2b: Have Learned the Basics, Now I Need Practice
In high school I taught skiing to children. Initially we focused on basic skills like balance and stopping. Once the basic skills were mastered lesson focused shifted to what we called “mileage”. We would expose kids to a variety of terrain and conditions to ensure they could generalize what they had learned and to build endurance and automaticity.
People who’ve learned the basics of programming (in Ruby or another language) need resources that help them get coding “mileage”. The resources below are the ones I’ve tried and recommend for folks in this stage.
The Ruby Koans are my first recommendation for folks transitioning to Ruby from another OO language. I like that they are succinct and can be worked through in an evening or one file at a time over a couple weeks. I feel like the koans cover Ruby basics and well as some of “weird” things like re-opening classes and blocks. I also appreciate that TDD and testing are used to drive the learning experience. Testing is part of idiomatic Ruby and Ruby culture and I appreciate resources that drive that home from the beginning.
I like the problems that Exercism presents and I like the format (again, yay for resources that encourage testing). I think the strongest aspect of Exercism is the peer review. In Ruby you can do one thing several different ways but there are some solutions that are more idiomatic than others. For folks who are still writing idiomatic Perl (or C# or Java) in Ruby the low stakes peer review is valuable to learn what idiomatic Ruby looks like.
Project Euler is a programming challenge site not a learning resource. That said, the problems are small and perfect for learning Enumerable and the Math parts of the Ruby Standard Library. I think it is best for folks with a strong math background, a solid understanding of high school algebra and geometry are required. I found some basic number theory, graph theory, and CS helpful. I like the fact that the problems are self grading. I will state that the Ruby solutions submitted in the forums (only visible once you’ve solved a problem) aren’t always idiomatic Ruby so don’t assume they are “the correct way”. I like comparing solutions in different languages to see which languages are best suited to different problems.
Several folks I respect say that the best thing new programmers can do is to write a lot of code. I think there’s a lot of truth in the parable of the pots. There are two things I think can help newer developers to “just write code”. First, remember that it is okay to throw code away. It is also okay to do projects with no practical purpose other than practice. Second, if you can’t think of a project look at the things you do frequently and see if there’s a program that could make it easier for you.
Contributing Open Source
Another common suggestion for folks looking to practice coding is to contribute to open source projects. Finding projects that have issues at your skill level can be hard but they are out there. Frequently newer developers can make better contributions by trying to reproduce issues and contributing to documentation. Contributing in any way to an existing project will require reading existing code which is an undervalued way to improve your own code. If you are looking for an open source project to contribute to start by looking at the things you use regularily or the things that folks you know work on. Contact the authors, tell them you are a beginner, and ask if there’s some place you can help.