Little Known Ways to Ruby Mastery by Bruce Tate

A weekly series from the Ruby Masters

Welcome to the next 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. We welcome your suggestions for interviewees and questions. Look for a new post every Tuesday!

This week, we’re happy to have Bruce Tate from USA.

Satish Talim>> Welcome, Bruce and thanks for taking out time to share your thoughts. For the benefit of the readers, could you tell us something about your self?

Bruce>> I am a kayaker, mountain biker, and father of two beautiful girls in Austin, Texas. I work as the CTO of WellGood, LLC, a company that specializes in building software that can make money and solve a social problem, like getting supplies to teachers or letting people give a donation to their favorite charity as a gift. I was a prolific author and speaker in the Java space. I moved to Ruby around four years ago, and haven’t looked back since.

Willian Molinari, Brazil>> How should one go about learning the Ruby language? What material (books, eBooks, online tutorials etc.) would you recommend?

Bruce>> The best way to learn Ruby is to use it. Pick a problem that’s easy enough for a first problem, but hard enough to put the language through it’s paces. If you can find a way to use it at work, that’s even better. I have my favorite set of books. The PickAxe book by Dave Thomas is a great book, and the new book by Matz called the Ruby Programming Language is brilliant. Several smaller resources are available too. I like Why’s Poignant Guide to Ruby, a quirky cartoon that walks through an exercise about an hour or two long. And through the first year of your development, you should work through a few Ruby Quiz problems. Some are easier and some are tougher, but the Pragmatic Press has them in book form and every problem is instructive.

Keith Brady, Australia>> What are the pros and cons of Ruby that are being discussed in the development community and what is your opinion on that?

Bruce>> Ruby is my language of choice because the syntax doesn’t get in my way, and the object model is pure. Since Ruby is highly dynamic, it’s easy for advanced developers to build their own languages to solve critical problems, and beginners get the benefits of using those programs. That means that there’s less to type, understand, and debug. For example, a programmer can open up a number class and add methods to convert to hours, minutes, days, and weeks. In code, you might see something like 10.days, which is much more readable than some unwieldy constant.

There’s a down side to all of that freedom, too. Ruby is like a sharp knife. You can carve something beautiful with it quickly. You can cut your thumb off, too.

Dennis Theisen, Germany>> Could you name three features of Ruby that you like the most, as compared to other languages? Why?

Bruce>>

  1. I love the way that Ruby handles collections. As a coder, I deal with arrays and hashes. All of the abstractions for things like lists, queues, sets, bags, and the like are built into those two. That means I don’t spend much time thinking about precisely which collection I want to use, and I don’t box myself in once I pick a collection. If the collection needs a key, it’s a hash. If it doesn’t, it’s an array.
  2. I love code blocks. The whole implementation is easy. I can write a quick one-line code block or a multi-line block with friendly syntax for each. Code blocks are everywhere in Ruby. Whether it’s a quick hitting one liner ( 3.times {do_something_tedious} ) or managing transactions, for example:
    Bank.transaction do 
      my_account.debit(amount)
      your_account.credit(amount)
    end

    you can use code blocks anywhere that you need to pass code into a code.

  3. I love the way new languages roll off your fingertips. When I’m using ActiveRecord, in an Employee class, I can say “belongs_to :department” and I’m done. I don’t need to break away from this code to build a mapping, and the mapping reads like a sentence. By making my code read like a sentence, I can reduce my total coding effort and maintenance time.

Jerry Anning, USA>> What best practices are most important for a new Ruby programmer to learn and understand?

Bruce>> Test, test, test. Very early on, learn a testing framework. Measure your code coverage, and learn to write your tests first. It will save you more time than you can possibly understand right now.

Jerry Anning, USA>> Can you recommend things to study after learning Core Ruby, including different frameworks, gems and external libraries?

Bruce>> Get to know rcov for coverage, and pick a testing framework that works for you. Get a good editor that you’re comfortable with. I use TextMate, but it’s infinitely better on OS x. If you’re on Windows, you will need something else. And after that, let your problems dictate where to go. Start with a problem, and then move on to which frameworks and gems you need. It’s not like PhP or Java where you’ll need 50 classic frameworks to start. Often, the core or Rails will take you a long way.

Satish Talim>> Most beginners in Ruby, would like to contribute their time, skills and expertise to a project but invariably are unaware of where and how to do so. Could you suggest some?

Bruce>> You can always find a project that needs better code coverage and start from there. It’s fairly easy to install rcov. That will point you to uncovered lines of code. You can then write some tests to cover those cases and submit them. Again, let your problem dictate the tools you want to test.

Keith Brady, Australia>> What types of applications are currently being developed in Ruby and what changes do you foresee over the next year or two?

Bruce>> I am a boring Rails developer. It works for me. I do see a huge jump in scalability over the next two years for a variety of reasons, including the emergence of solid virtual machines, great work on making things thread safe, and the excellent JRuby package which will let Ruby work on established Java platforms. Also, internationalization will enable better support for applications that span languages.

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?

Bruce>> It’s expanding rapidly. I’m not in the market, but there’s no shortage of consulting offers.

Michael Uplawski, Germany>> According to you, what is a comfortable size of a Ruby/Rails-project? Why?

Bruce>> You can do amazing things with very small teams. Rails gives you so much more leverage. My current projects use teams of 1-3 developers and 1 designer. I also work with a very good analyst, and that helps. But I try to work with very small teams of very good programmers. I find that’s about like a team of six to twelve Java programmers using the technologies I was using four years ago. (It’s probably better now, because Java is not standing still.)

Michael Uplawski, Germany>> Having spent some years in the I.T. industry and coming to Ruby from a different background, how do I recognize Ruby’s limitations so as to suggest a different language in such cases?

Bruce>> This is a great question. It’s easy to pick up a golden hammer and see every new problem as a nail. I tend to use Ruby on very complicated problems, because the language lets me express ideas with less clutter. I use Java for simpler problems that absolutely must scale beyond where I’m willing to take Ruby. I also use non-traditional approaches, like SQL scripts, simple spreadsheets, and editor macros for quick hitting problems where I might have written code before.

Dennis Theisen, Germany>> Do you think Ruby is ready to be used in “Enterprise applications”? Kindly justify your answer.

Bruce>> I’m a CTO. We’ve bet on Ruby. It’s been incredible for us in terms of productivity. We’ve never had a scaling problem we couldn’t solve, but we’re not E-bay yet, either.

Satish Talim>> What can / should job candidates (for Ruby) do to distinguish themselves from their competition?
Note: The candidate has done his/her homework on the company that they are interviewing with. The candidate understands what they’re looking for, and the candidate is prepared to show them that he/she fits the bill, based on the candidate’s skills and experience. What else can the candidate do, to set themselves apart from other equally well-qualified and well-prepared candidates?

Bruce>> Code with good people. Open Source is a good way to do that. There’s no substitute for coding in a productive environment.

Satish Talim>> Do you have any other suggestions for these participants (would-be Ruby developers)?

Bruce>> I can’t think of any.

Satish Talim>> Thanks Bruce for sharing your views with the RubyLearning participants.

On 2nd Dec. we talk to Ezra Zygmuntowicz from USA.

Disclaimer:
The opinions expressed are those of Bruce Tate and do not necessarily reflect those of www.RubyLearning.com.

The Path to Ruby Mastery Series (So Far):

      <p>
        Technorati Tags: <a href="http://technorati.com/tag/Interviews" rel="tag">Interviews</a>, <a href="http://technorati.com/tag/Little+Known+Ways+to+Ruby+Mastery" rel="tag">Little Known Ways to Ruby Mastery</a>, <a href="http://technorati.com/tag/Ruby" rel="tag">Ruby</a>, <a href="http://technorati.com/tag/Ruby+Beginners%26%238217%3B+Questions" rel="tag">Ruby Beginners&#8217; Questions</a>, <a href="http://technorati.com/tag/Bruce+Tate" rel="tag">Bruce Tate</a>, <a href="http://technorati.com/tag/The+Ruby+Programming+Language" rel="tag">The Ruby Programming Language</a>
      </p>
comments powered by Disqus