Posted by Lena Sat, 24 Oct 2009 21:12:00 GMT

Doing client work for Upstream, I recently had the pleasure of pair programming with fabulous Pat Allan for a month. Here are a few of the things I learned.

  1. Pair Programming is a good thing (not that I haven't known that before). Here is yet another good article about pairing if you aren't convinced yet. Next to improved concentration, keeping each other from getting stuck in stuff, I like the sharing of best practices, Textmate short cuts, syntax tricks etc.
  2. Instead of writing "puts" in, after and before blocks that don't act as expected, use ruby-debug. It's really easy, and gives you so much more information about your situation. Just do:
    sudo gem install ruby-debug
    And in your code, at the place you want to examine:
    require 'ruby-debug'
    debugger
    Then restart script/server with the --debug option. It stops when the line where you put 'debugger' is reached. You can directly call variables to explore their values. The basic commands are:
    • n - next
    • s - step into method
    • c - continue to breakpoint
  3. Read the source code of the gems you're using. If you are not sure how to do something with the gem, the actual code is often more informative than documentation. Lachie Cox describes in his blog how to set up a Textmate shortcut with which you can access all your gems without any typing.
  4. Rubular is a nice app to test regular expressions in your browser.
  5. I have never used RCov before. Of course it doesn't mean too much, but having a test coverage of 97,7% feels good, I can tell you. A Code to Test Ratio of 1:2.7 is not bad either.
    The RCov gem has moved to Relevance, read here how to set it up for an RSpec/Cucumber environment.
  6. And finally, I got convinced that it's good to have a blog ...

Here we are!

no comments |

Trackbacks

Use the following link to trackback from your own site:
http://lenaherrmann.net/trackbacks?article_id=1

Leave a comment

Leave a comment