Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What are your thoughts on the habit of wrapping virtually every recurring piece of code in its own method? In case the implementation has to be overridden?

E.g.:

def current_time

  Time.now
end

vs. just repeating Time.now inline within all of the calling methods?



> In case...

When it happens, deal with it - odds are it won't. Expend the energy making the code base testable not pretending to be an insurance company ("In case sh..").




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: