Tell Don't Ask, unit tests and mutable state

If you follow the "Tell, Don't Ask" style, objects have very little visible state to assert about.

...

When writing a program, I care only about what that program does, not the internal state that the program uses to control what it does. The only visible behaviour that a program has is its interactions with external entities

...

Mutable state makes a program harder to understand and maintain

...

"Doing encapsulation right is a commitment not just to abstraction of state, but to eliminate state oriented metaphors from programming." — Alan Kay


Read the full post: http://nat.truemesh.com/archives/000342.html


Print | posted @ Wednesday, August 18, 2010 2:34 PM

Comments on this entry:

Gravatar # re: Tell Don't Ask, unit tests and mutable state
by Antonio Ganci at 8/19/2010 8:36 AM

Nel post che hai segnalato è linkato anche il pdf di The Early History of Smalltalk se non l'hai ancora fatto è una lettura molto interessante sull'object oriented (anche se un po' difficile). Perchè descrive da cosa è nata l'idea dell'oo e di come poi purtroppo si è sviluppata in una direzione diversa.
Comments have been closed on this topic.