Smallest Shield

A lot of the text from ShieldPattern could be useful here.


SmallestShield says you will do well for your program if you use the smallest possible shield at any moment. Shields are, from smaller to larger:

I guess that I or we finally have enough data to write up Shield as an official pattern (I have been teaching it for several years but never thought to write it up 'till seeing this new use of it).

AlistairCockburn


A shield should be big enough to cover all the functionality required by clients who are not also creators. Creators can have a reference to the implementation, so nothing is shielded from them. If they hand the shielded object to others, the shield should be big enough for the purposes of those others. The cost of the shield is how much effort it takes to change all the implementations if the shield is changed. I can see two rules here:

--JohnFarrell

I don't quite agree with that. The same logic can lead you to the conclusion that you don't need a class for a singleton object - just make its data and its methods global, instead of passing it back and forth between your functions. It will work, and produce the same results, but it is less comfortable. The RightThing seems to be using more abstraction/encapsulation/shielding (circle you choice). -- AmirLivne


CategoryPattern


EditText of this page (last edited March 30, 2002) or FindPage with title or text search