mercredi 18 mars 2015

What is the difference between the read-only interface pattern and the facade pattern?

Say I write a facade for a class and expose all it's methods except for it's setters. What is the functional difference with the read-only interface pattern?


Based on the wikipedia article on immutable interfaces I'd say the facade has the advantages of the immutable interface (when I name my class Foo and my facade is ImmutableFoo) while not having the disadvantage of being able to cast the immutable interface "to their concrete, mutable type, and have their state mutated".


Aucun commentaire:

Enregistrer un commentaire