News for hackers. Stuff that matters.
Re:Am I Doing it Wrong? by aphyr on Friday June 22, 2012 @07:09PM (#4149364)
1. Testing is easier without state. I'm trying to illustrate that state and context (and namespaces) are separable.

2. Swapping implementations is easier: would you rather pass a function, or an object with a single function? This ties back in to testing: it's easier to create a test variant of a function than it is to create a new class.

Don't get me wrong: state is great, and I use it all over the place. I generally avoid it, though, unless the state is needed, simpler to understand, or more concise.

There are no comments on this comment yet.