Articles by Jared Carroll

Jared Carroll

Jared Carroll

TDD: Getting to Green One Small Step at a Time

When getting a failing spec to pass, it’s important to do the simplest thing that can possibly work. In Kent Beck’s classic book on TDD, he outlines several approaches for quickly “getting to green”. I regularly use 2 of these to help maintain focus and constantly make progress towards an implementation: faking it and triangulation.

Jared Carroll

Jared Carroll

Shy Tests and Ping Pong Pair Programming

I’ve had my best pair programming experiences using a technique called ping pong pair programming. This is a back and forth style of development that goes something like this: pair A writes a test pair B makes it pass pair B writes a test pair A makes it pass This is a great way to

Sunset
Jared Carroll

Jared Carroll

Better Error Handling in Ruby with Rescue Else

The other day I came across some code that was making HTTP POST requests to a 3rd-party API. The API used 3 types of HTTP response codes: 200 (Ok) 422 (Client error) 500 (Server error) Here is the code: The error handling in the above code seems to be casting too wide a net because

Jared Carroll

Jared Carroll

TDD your way to a richer domain model

A well established and accepted design principle in the Rails community is “skinny controller, fat model”. This involves placing an application’s domain logic in models and keeping the request handling controllers simple and sparse (i.e. “skinny”). The result is a more modularized, reusable, rich domain model. The following is an example of using TDD to

Jared Carroll

Jared Carroll

RSpec best practices

Rspec is a great tool in the behavior driven design process of writing human readable specifications that direct and validate the development of your application. We’ve found the following practices helpful in writing elegant and maintainable specifications. First #describe what you are doing … Begin by using a #describe for each of the methods you