Refactoring a dead horse

May 10, 2009 Adam Milligan

A while back I made the point that the HasOneThroughAssociation class in Rails shouldn’t be a subclass of HasManyThroughAssociation. I also submitted a Rails patch in which I changed the superclass of HasOneThroughAssociation from HasManyThroughAssociation to HasOneAssociation and moved the shared Through functionality into a module. Despite support from the teeming millions, Rails core team member Pratik rejected the patch for being “just a refactoring.”

Despondent, I brought the issue up here at Pivotal a few months later, after the Release of Rails 2.3. Nate added a callout for support for the ticket to the daily Pivotal standup blog. The response was heartwarming (thanks to all who added a +1), but resulted only in Pratik removing himself from the ticket (I assume so he would stop getting comment notifications).

All is not lost, however. At RailsConf last week, Jeff Dean — Pivot, raconteur, international playboy, and refactoring paladin — called out the Rails core team regarding their stance on refactorings. The response: bullish (sort of).

Taking into account the responses from the Rails core team, I’ve done the following:

  • Recreated the patch for current Rails edge. Fortunately, I had to make only one small change to the patch from six months ago.
  • Ran a search on GitHub for any code using the HasOneThroughAssociation class (thanks to Jeff for the idea). As far as I can tell no code outside of Rails depends on the implementation of that class.
  • Added Jeremy Kemper as the owner of the Rails ticket. He was the most immediately supportive of refactoring patches, so hopefully he’ll advocate for this one.

We’ll see what happens.

About the Author

Biography

More Content by Adam Milligan
Previous
Capturing Standard Out In Unit Tests
Capturing Standard Out In Unit Tests

def capturing_output output = StringIO.new $stdout = output yield output.string...

Next
Best Buy Remix Java Library
Best Buy Remix Java Library

A while back Matt Williams created a Java API for Remix: Remix.java at Google Code Thanks Matt! Best Bu...

Enter curious. Exit smarter.

Register Now