Confident Code, by Avdi Grimm

Are your methods timid? Do they constantly second-guess themselves, checking for nil values, errors, and unexpected input?

Even the cleanest Ruby codebases can become littered over time with nil checks, error handling, and other interruptions which steal attention away from the essential purpose of the code. This talk will discuss strategies for writing your Ruby classes and methods in a confident, straightforward style; without sacrificing functionality or robustness. In the process, we'll cover concepts and techniques points including:

  • The narrative style of method construction
  • The four parts of a method
  • Three strategies for dealing with uncertain input
  • Massaging input with coercion and the Decorator pattern
  • Lightweight preconditions
  • Exterminating nils from your code
  • The chaining and iterative styles of method construction
  • Eliminating conditionals with the Special Case and Null Object patterns
  • Isolating errors with the Bouncer and Checked Method patterns

Edit proposal

Submissions

Cascadia Ruby 2011 - Accepted [Edit]

RailsConf 2011 - Accepted [Edit]

RubyNation 2011 - Accepted [Edit]

Ruby Midwest 2011 - Accepted [Edit]

GORUCO 2011 - Rejected [Edit]

RubyConf 2011 - Rejected [Edit]

Add submission