CSC/ECE 517 Fall 2010/ch7 7e GS: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 9: Line 9:
That is an external object trying to modify another object can only do this by the means of a wrapper which wraps the object to be accesed. Thus this insulates the objects from any changes or variation to other objects.
That is an external object trying to modify another object can only do this by the means of a wrapper which wraps the object to be accesed. Thus this insulates the objects from any changes or variation to other objects.


Some of the standard practices motivated by this pattern are '''Data encapsulation, interfaces, polymorphism and indirection.'''
Some of the standard practices motivated by this pattern are '''Data encapsulation, interfaces, polymorphism and indirection.'''. Also the Protected Variation pattern in principle is very similar to the '''"Open-Close Principle"''' discussed in detail by Bertrand Meyer in [4] and also very similar to what David Parnas means by '''Information Hiding''' in [3].


== An Example ==
== An Example ==

Revision as of 01:20, 2 December 2010

Introduction

The protected variations pattern is one of the GRASP patterns. General Responsibility Assignment Software Patterns (or Principles), abbreviated GRASP, consists of guidelines for assigning responsibility to classes and objects in object-oriented design.[1]

The Protected Variations pattern protects elements from the variations on other elements (objects, systems, subsystems) by wrapping the focus of instability with an interface and using polymorphism to create various implementations of this interface.

Protected Variation Pattern

This pattern mainly deals with the problem of designing objects, subsystems and systems so that any variations or instability in these elements does not have an undesirable impact on other elements. The Protected Variation pattern tries to address this problem by identifying points of predicted variation or instability and assignsresponsibilities to create a stable interface (or protection mechanism) around them.

That is an external object trying to modify another object can only do this by the means of a wrapper which wraps the object to be accesed. Thus this insulates the objects from any changes or variation to other objects.

Some of the standard practices motivated by this pattern are Data encapsulation, interfaces, polymorphism and indirection.. Also the Protected Variation pattern in principle is very similar to the "Open-Close Principle" discussed in detail by Bertrand Meyer in [4] and also very similar to what David Parnas means by Information Hiding in [3].

An Example

Craig Larman in [2] discusses an example of the Protected Variations Pattern.

Conclusion

References

[1] Wikipedia GRASP patterns

[2] Protected variation: the importance of being closed, Larman.C, ISSN: 0740-7459, 89 - 91

[3] “On the Criteria to Be Used in Decomposing Systems into Modules” Comm. ACM, vol.12, no. 2, Dec. 1972

See Also