If someone wrote code like this:
class Account
...
end
class Customer
...
end
class Displayamajig
def display_account(account)
...
end
def display_customer(customer)
...
end
...
end
class Persistamajig
def persist_account(account)
...
end
def retrieve_account(account_identifier)
...
end
def persist_customer(customer)
...
end
def retrieve_customer(customer_identifier)
...
end
...
end
...
Would you suggest they rewrite things like this?
class Account
def display
...
end
def persist
...
end
def retrieve(identifier)
...
end
...
end
class Customer
def display
...
end
def persist
...
end
def retrieve(identifier)
...
end
...
end
If so, wouldn't it make sense that if you saw an application organized like this:
That you should refactor it into this:
Why? Why not??
Join the discussion on Hacker News.
Recent work:
- Kestrels, Quirky Birds, and Hopeless Egocentricity, all of my writing about combinators, collected into one convenient and inexpensive e-book.
- Katy, fluent CoffeeScript and JavaScript using combinators.
- YouAreDaChef, Coffeescript/Javascript method combinations for Underscore projects.
Follow me on Twitter. I work with Unspace Interactive, and I like it.