Person < World::Base
attr_reader :name => Johnneylee Jack Rollins
attr_reader :pseudonym => Spaceghost
Post < Thoughts::Blog
attr_accessor :comments
attr_reader :title, :subtitle, :meta, :content
title    = Coding dangerously
subtitle = Or why I would rather not use debuggers.
meta     = 28 May 2011 - Eugene, Oregon

I spend a lot of time in the #RubyonRails channel on Freenode. Sometimes a certain subject comes up that I have problems refraining from answering, or attempting to. That question goes invariably like, ”… debugger …”

I ommited the parts that aren’t important right now, my mind is already making a sad face. I start to wonder if it’s conviction or something sinister that gives me such a distaste for debuggers. The way I feel about debuggers is that you should be comfortable enough with the language to be able to write quick throw-away code to investigate the problem if you’re able to use the debugger with any skill whatsoever.

Perhaps that’s an unrealistic goal, but I digress. “Coding dangerously”, besides sounding like the newest hip craze you hooligans are into, is a practice of realizing it’s perfectly fine to write code you intend to throw away once you’ve found the information you needed.

Why would I want to write code I intend on tossing out? Well, that’s a good question. It may boil down to personal taste, but right now I’m on the soapbox. I find that I’m able to keep my present velocity when I take a moment to root around the program and get the data I need instead of dropping into ruby’s debugger.

My preferred methods of getting to the juicy bits of my program will likely always be #inspect, #instance_variables, and #logger from the stdlib as well as #debug in Ruby on Rails. Examples of their uses can be found on the rails guide for debugging. I’ll check back in later for some more advanced techniques for coding dangerously.

This is where we part ways for a while, I hope you enjoyed my mind as much as I do. Live long and code dangerously.

Make it sew,


Number of words in this post: 354
blog comments powered by Disqus
Fork me on GitHub