Little Known Ways to Ruby Mastery by Ryan Bates
20/Jan 2009
A weekly series from the Ruby Masters
Welcome to the last installment of the weekly interview series on the RL blog – “Path to Ruby Mastery” – by top trainers and developers in the Ruby community, from across the globe. The interview series will provide insight and commentary from these notable Ruby trainers and developers, with the goal of facilitating and providing answers to the questions Ruby beginners face.
This week, we’re happy to have Ryan Bates from USA.
Satish Talim>> Welcome, Ryan and thanks for taking out time to share your thoughts. For the benefit of the readers, could you tell us something about your self?
Ryan>> I started toying around with static HTML around 1996. A few years later I created a website for my father’s company using this little-known scripting language called WebDNA. As the site grew, I ported it over to PHP, and then later to Rails. Needless to say, Rails has been by far the most pleasant to work with.
I enjoy teaching, partly because I get to learn along with whoever I’m helping by researching topics I might not have otherwise. While beginning with Rails, I started answering questions on railsforum.com. Later I started Railscasts, the free Ruby on Rails screencast series. I’m also working with the Pragmatic Programmers on a couple screencast series: Everyday Active Record and [Mastering Rails Forms]().
Willian Molinari, Brazil>> How should one go about learning the Ruby language? What material (books, eBooks, online tutorials etc.) would you recommend?
Ryan>> It depends on what your past experience is. If you are very new to programming, I recommend reading Learn to Program. Next up the tier is Beginning Ruby: From Novice to Professional. And then there’s the classic Programming Ruby (also known as the Pickaxe book).
You may also want to Try Ruby!, where you can run Ruby commands interactively in your browser. If you enjoy problem solving, check out Ruby Quiz and a recent project of mine called Ruby Warrior (still in early development).
Finally, don’t only read books and work through examples. Find a real world problem, and use Ruby to solve it. Ask questions to the community if you can’t find the solution on your own.
Dennis Theisen, Germany>> Could you name three features of Ruby that you like the most, as compared to other languages? Why?
Ryan>> Ruby has spoiled me. Since learning it, I’ve found it much harder to work in other languages. These are the primary culprits.
- Blocks. They make iterations a breeze and so much more!
- Everything’s an object. Being able to call methods directly on integers, strings, arrays, etc. greatly simplifies the method interfaces.
- Metaprogramming. Injecting behavior at runtime opens up so many possibilities.
Jerry Anning, USA>> Can you recommend things to study after learning Core Ruby, including different frameworks, gems and external libraries?
Ryan>> There’s obviously Rails which I recommend every Ruby programmer try, even if you aren’t into web development. It handles Ruby in a different way (both good and bad) than what you see in many other projects. Also, go through the various methods in Active Support and extlib. Doing so will make reading other projects that use these easier, and may improve the code you write.
Also, if you haven’t already, I highly recommend signing up to GitHub. It has made a huge impact on improving myself as a programmer. Get involved with other programmers, read their code, and share your own code.
Jerry Anning, USA>> What best practices are most important for a new Ruby programmer to learn and understand?
Ryan>> There are three best practices which have made a world of difference for me: testing, refactoring, and naming.
It took me a long time to grasp automated testing. The best advice I can give is: don’t give up on it too soon. Start with a project that is easy to test (maybe the models in a simple Rails app). Once you establish a testing rhythm it gets easier, and the payoff is well worth it.
One of my favorite things about Ruby is how natural it feels to refactor. If you don’t know what refactoring is, I recommend reading Martin Fowler’s book on the subject. It’s not in Ruby, but the concepts he teaches still apply. Also keep an eye out for the Ruby edition of this book.
Finally, learning how to give proper names to variables, methods, and classes will help make your code much more readable. Find concise yet descriptive names and stay consistent with them across your application. This does wonders towards improving the readability of the code.
Victor Goff, USA>> How do you see the market for Ruby Programmers in the work place, and do you see it as primarily tied to Rails and Web related work? Do you see trends in administration or other work? What’s the future for Ruby?
Ryan>> I think web applications play a very significant role in the future, not only in Ruby, but also in our society. Every day it seems we are moving away from the desktop and more into the cloud. But the buck doesn’t stop at Rails. I suspect Ruby will far outlive Rails in the web development world as we see other innovative Ruby frameworks come into play. Overall, I think Ruby has a very bright future in the work place.
Michael Uplawski, Germany>> According to you, what is a comfortable size of a Ruby/Rails-project? Why?
Ryan>> I find Rails scales very well for a wide range of project sizes. I’ve worked with apps ranging from 3 models to 100 models and it has handled both great. The most comfortable size is probably somewhere around 10-40 models.
Where Rails is not as applicable are the two extremes. If you’re app is very small (only a few pages, or mostly static content), there are other languages and frameworks which are lighter weight and easier to deploy. I don’t have much experience with gigantic enterprise apps, but I imagine there’s a limit you could reach where Rails isn’t as practical in how it organizes things. As Rails improves (especially with Rails 3), it will become more and more applicable to these other types of projects.
Satish Talim>> Thanks Ryan for sharing your views with the RubyLearning participants.
Disclaimer:\ The opinions expressed are those of Ryan Bates and do not necessarily reflect those of www.RubyLearning.com.
The Path to Ruby Mastery Series (So Far):
- #1: Jamie van Dyke
- #2: James Edward Gray II
- #3: Dr Nic Williams
- #4: Stuart Halloway
- #5: Jay Fields
- #6: Chris O’Sullivan
- #7: Guy Naor
- #8: Jonathan Conway
- #9: Ian Dees
- #10: Bruce Tate
- #11: Ezra Zygmuntowicz
- #12: Chris Matthieu
- #13: Peter Cooper
- #14: Yehuda Katz
- #15: Ilya Grigorik
- #16: Josh Susser
- #17: Thibaut Barrere