After several refactorings to WikiController
, finally the #special
method isn’t pretending to be a traffic cop anymore (routing to other methods). Since it doesn’t have any other purpose now, I’m going to use remove method to toss it into the bit bucket.
Before
1 2 3 4 5 6 7 8 9 10 |
class WikiController 'export', :id => @project # Compatibility stub while refactoring return else # requested special page doesn't exist, redirect to default page redirect_to :action => 'index', :id => @project, :page => nil return end render :action => "special_#{page_title}" end end |
After
1 2 3 |
class WikiController < ApplicationController # No more special end |
I love the refactorings when I can throw away old code. What is surprising to me, is that the refactoring catalog doesn’t have a remove method as a refactoring. Should it not be a refactoring? Or is it that programmers don’t remove code enough for it to be considered a common pattern?