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

clearTotals() arguably made more sense than other "abstractions", on the grounds that if you have more than one piece of state to reset/initialize, you want to centralize the knowledge of which variables must be set together - otherwise it's too easy to add another piece of state and forget to set it everywhere it should be.

Of course, a method is but one of several ways you could capture that information, and not always the best one.



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

Search: