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

I don't think there's any use of a heavy pattern in there, it's just leveraging the basic OO idea of state.

My rule of thumb is to use class methods as factories to initialize your object in a certain way, which is quit consistent with what the class method `new` does. Once you stay in that line of thought the rest flows quit naturally without over-thinking anything.



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

Search: