Skip to content

Monthly Archives: October 2008

Writing Self-Confident Code

A common idiom in ruby is to call a method only if its receiver is not nil:

thing.foo if thing

or:

thing && thing.foo

Various libraries exist for making this a little more convenient. You can use andand, or if you are using Facets you can use ergo. And seriously, you should be using them – they […]

Complex Hash Expectations in RSpec

When spec-ing something that calls method which takes a set of nested hashes (as many Rails methods do), it may be tempting to use #hash_including to test for only the values you care about. However #hash_including won’t work the way we might hope for nested hashes. Take the following (highly contrived) example:

describe CoffeeMaker […]

Testing Private Methods

Periodically the question of how to test private methods comes up at work or online. My answer is: don’t. It may seem trite, but there is some reasoning behind it.

Private methods are, by definition, implementation details. If you are approaching your tests from a behavioral standpoint – and you really should be, […]

Languages I Want to Learn

I’ve fallen off the wagon of late in learning “a language a year” (as The Pragmatic Programmer advises). I have a long list of languages to learn, but I thought I’d try and narrow it down to a top five. Here goes:

Io – the more I work in OO the more I am […]

If anyone’s looking for me, I’ll be DCamping

I hope to see some of you at Ruby DCamp this weekend!

You keep using that word “distributed”…

People keep telling me that GitHub is the “killer app” of git. Perhaps they meant “productivity killer”?

I submit to you that if your distributed version control workflow has a single point of failure that can bring your work to a crashing halt, you haven’t grokked distributed version control.

I’ve been watching with some concern as […]