3 ms·
Reminded me of this section from the Rspec book - http://cl.ly/2x231s0N2v3C2P1S1z04 http://cl.ly/2x231s0N2v3C2P1S1z04, http://cl.ly/2R1Z1D450Y1n1n3L170b http://
by jonmc12 15y ago
Reminded me of this section from the Rspec book - http://cl.ly/2x231s0N2v3C2P1S1z04 http://cl.ly/2x231s0N2v3C2P1S1z04, http://cl.ly/2R1Z1D450Y1n1n3L170b http://cl.ly/2R1Z1D450Y1n1n3L170b - which applies to testing object-oriented code by mocking objects and putting assertions on the interaction between objects (vs vis versa).
"Object-oriented systems are all about interfaces and interactions. An object’s internal state is an implementation detail and not part of its observable behavior. As such, it is more subject to change than the object’s interface. We can therefore keep specs more flexible and less brittle by avoiding reference to the internal state of an object."
This 'Plumber Programmer" article is meant to be more general than object-oriented code, but I think the analogy applies. Building systems is about interaction and communication - system state is just an illusion that gives us a first approximation of how things talk to one another.