Query actions in Rails controllers

May 14, 2013

1

Recently some of my controller actions have taken on a definite new shape. Particularly when the action is a read-only query of the app’s state. Such actions tend to make up the bulk of my apps, and they can be simple because they are unlikely to “fail” in any predictable way. Here’s an example from […]

Why shorter methods are better

January 30, 2013

27

TL;DR Longer methods are more likely to need to change when the application changes. The Longer Story Shorter methods protect my investment in the code, in a number of ways. First: Testability. I expect there to be a correlation between method length (number of “statements”) and the number of (unit) test cases required to validate the method […]

Posted in: adaptability, quality

A testing strategy

January 18, 2013

7

The blog post Cucumber and Full Stack Testing by @tooky sparked a very interesting Twitter conversation, during the course of which I realised I had fairly clear views on what tests to write for a web application. Assuming an intention to create (or at least work towards creating) a hexagonal architecture, here are the tests […]

I’m growing a mo

November 4, 2012

0

Two years ago the fantastic staff at Macclesfield hospital saved my life. To cut a long story short, my colon burst due to diverticular disease; Mr Khan and Mr Hadjiloucas correctly diagnosed it and operated in the nick of time. (Seriously. Two hours later and I would have been gone.) I had two 6-hour operations […]

Posted in: Uncategorized

The problem with code smells

September 3, 2012

9

Like most developers I know, I have used code smells to describe problems in code since I first heard about them. The idea was introduced by Kent Beck in Fowler’s Refactoring back in 1999, and has taken root since then. The concept of code smells has several benefits, not least the fact that it gives […]

Posted in: quality

Hexagonal rails: Rake tasks are adapters

July 11, 2012

12

If I’m thinking about my Rails app in terms of a hexagonal architecture, I find it also pays to consider every rake task to be an Adapter. Thus: The true picture is a little more complicated than that, but the principal ideas are there. The rake task acts as a mediator, allowing me to send […]

Hexagonal rails: Hiding the finders

July 6, 2012

15

This is a brief follow-up to the Hexagonal Rails sessions I did last week at the Scottish Ruby Conference with Matt and Steve. We tried to cram a 3-day course into 45 minutes, with inevitable consequences. So by way of an apology, here’s another brief foray into some of the same territory… Today I’ve been […]

Follow

Get every new post delivered to your Inbox.

Join 1,017 other followers