Daily Refactor #52: Remove Middle Man Kanban#find

The Refactoring

Now that everything has been refactored out of Kanban#find, there really is no use for it. All that it does is to wrap the constructor so it’s now useless code.

Before

1
2
3
4
5
6
# app/models/kanban.rb
class Kanban
  def self.find
    Kanban.new
  end
end

After

1
2
3
4
# app/models/kanban.rb
class Kanban
  # ...
end

Review

After every refactoring session you will have some useless code left over. Sometimes it’s to keep a public API stable, sometimes it’s a simple delegate, and sometimes (like now) it’s just garbage that should be thrown away. Whenever possible, throw it away. If you need it back, git will be there.

Reference commit