Fork me on GitHub

Tools of the Trade - The Hobby Rubyist

I thought I would have a go at this "tools of the trade" post that many Ruby developers are posting.

I think most people who will post these lists will be full-time or contract developers who at least get to do some Ruby or Rails development in their work day. I myself don't have the benefit of being able to work with Ruby as part of my job. Instead I've been working with Ruby as a hobby.

Here's my list:

Hardware

  • 13" Macbook (black) - I bought one of these a couple of years ago and it's been superb as a development platform. Hoping to add a memory upgrade in the next few months to take me from 2Gb to 4Gb. I've also recently upgraded to Snow Leopard.

Software

  • TextMate - The editor of choice if your using OS X but recently there has been a lot of chatter about Emacs and Vim.
  • Pixelmator - Excellent image editing software for a fraction of the price of Photoshop.
  • Terminal - Apple's built in terminal emulator does the job for me.
  • Safari - I've settled primarily on using a single browser for my projects for the moment.
  • Git and GitX - Git is the SCM of choice for me. If you want a quick installer for OS X then you should try git-osx-installer

Web Services -

Not web services in the traditional sense of development, but organisations who offer free services that help with me with my development.

  • Heroku - If your looking for easy deployment to a staging or live server then you really can't get much simpler than this. Heroku allows you to quickly deploy your app from your repository with just a few simple commands. I've just started to use Heroku to stage a couple of applications, but in the future I may look to roll a couple of websites with them.
  • GitHub - I've only just started putting some projects onto GitHub. Great if your working on open source projects or you want to roll your own version of something already hosted on GitHub.
  • Posterous - I've been posting interesting bits in Ruby for a while now using my Posterous blog. I originally used a self-hosted Wordpress blog, but I've been trying to cut back on having to maintain too many things and instead using tools that just work. With Posterous, I'm able to email all my posts and have them published to Twitter at the same time. Easy!

Resource & Learning

  • RubyInside & RailsInside - Peter Cooper's Ruby blogs are a necessary read when your working with Ruby. All the best news on the Ruby and Rails communities in one place. 
  • Railscasts - Ryan Bates has been knocking out these great screencasts for a couple of years now. They're an excellent source of information on Rails.
  • Ruby5 - 5 minutes of Ruby related news in a podcast. Easy to consume and no need to follow hundred's of different blogs!
  • The Pragmatic Bookshelf - I bought a few titles over the years from here. It's always been a good place for not only Ruby and Rails, but project management and agile.

I've left out a lot of other tools that could have made the list, but these are just support tools like Evernote, Dropbox and Google Apps. I didn't add these to the list because I don't think they belonged here. I wanted to only list the necessary tools I need to write Ruby applications.

This list might be minimal but I thought it could act as a starting point for people who are new to Ruby and just want to start learning with basic tools.

I'm Reading Source Code to be a Better Developer

When I heard about Ruby and Rails a couple of years ago, I looked at a couple of books on the subject and promptly bought them. I spent a couple of hours a week  trying out things with Ruby and building a couple of applications using Rails. As informative as these books were, I always felt as if I was still missing something.

The problem was that books could only tell you so much. Books often give you basic code to learn the feature of a language or framework. This isn't a bad thing, but I wanted to progress more. I wanted to move from just having beginner Ruby code to a higher level.

In order to achieve a higher level of understanding Ruby (and Rails and Sinatra too!), I have started to read the code of other Ruby applications out there. Having spent enough time following developers in the community through RSS feeds and Twitter, I'm informed enough to make a decision on what source code would make interesting reading.

For this month I have been looking at the retweet application on Github by Nick Plante. Retweet is an application template for building simple Twitter applications. 

It's a fully featured Sinatra application from a developers point of view with rake tasks and specs. For myself this is great because I have failed in the past with rake tasks for my Sinatra applications and having looked through the source code for retweet, I now understand where I went wrong and how to correctly implement rake tasks.

Now, before you go off and start reading through the source code of projects yourself, remember this:

Reading source code isn't about just looking at the code and saying "I'll have that!"

Reading source code means that you have to understand what the code is doing. You can do a couple of things to understand what the code is doing:
  1. Put your own comments in the code - Start with a class in your chosen project and start from there. When you've read through some code and understand how it works, stick some comments in it to remind yourself of what it does. You'll then have some notes that you can refer back to when your reading further code from your chosen project.
  2. Write some tests - In order to gain a further understanding of the source code your reading, write some tests for it. We all (I hope) use tests to ensure our applications are working correctly, but tests are also a great way of understanding how code works without having to run the whole application.
I'm going to continue with this exercise once a month, alternating between a Sinatra application and a Rails application. At the end of each month, I'll do a small summary post of interesting things I have found within each project. Hopefully this will lead to me having a better level of knowledge of Ruby and also allow me to write better code.

Snippets #14

  1. Class and Instance Methods in Ruby - John Nunemaker shares some insight into some basics of classes in Ruby.
  2. Include vs Extend in Ruby - Following on from methods John looks at adding methods to your classes from other libraries.
  3. Memoization in Ruby and Python - A look at the memoize optimisation technique.

Learn The Language Then The Framework

When Ruby on Rails first appeared on the scene, it attracted interest from all types of developers who were looking for something different to work with.  Over the last few months the uptake of developers using Rails has been colossal.  However along side this popular framework comes a down side.

Too many developers are using frameworks without understanding the underlying language.

While most seasoned developers of Rails have an in depth understanding of the framework, they also understand how the language works.  This allows developers to make these frameworks work for them in ways that new comers to the framework and language, find difficult to understand.

All too often new comers to the framework want to dive right in and build the next big thing.  That’s fine if you wish to do that, but the real power comes from knowing all about the underlying language and how it drives the framework.

So, if your a new comer to a framework such as Rails, Merb or Django, then take the time to learn the language underneath.  It doesn’t take long either.  If your learning a new language, then it should only take you a few months to know your way about.

When your learning your new language you don’t need to write the next big thing either, just write something to solve a particular problem.

Doing this will help you springboard into your preferred framework and help you wield it in ways you didn’t think were possible.

Learn the language, then the framework.