3 ms·
1. Testing is easier without state. I'm trying to illustrate that state and context (and namespaces) are separable. 2. Swapping implementations is easier: woul
by aphyr 14y ago
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.