Skip to content

Latest commit

 

History

History
110 lines (71 loc) · 2.26 KB

another_question.md

File metadata and controls

110 lines (71 loc) · 2.26 KB

I have a question about organizing projects:

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:

A Standard Rails App

That you should refactor it into this:

A Refactored Rails App

Why? Why not??

Join the discussion on Hacker News.


Recent work:

Follow me on Twitter. I work with Unspace Interactive, and I like it.