Design Patterns : What does mean by 'scope' (Class/Object) in a Design pattern? Whats the reason of class/object classification? Certain design pattern is scop开发者_JS百科e of Class, another one is Object scope..How do we recognize that?
A pattern may either be class-scope or object-scope. Class-scope patterns are those patterns whose goals are realized at compile time using mechanisms like inheritance. These patterns need no further configuration at run-time. On the other hand, object-scope patterns which are more common leverage relationships between objects in order to achieve their goals. Object scope patterns tend to solve the problems by using instances of different polymorphic classes interchangeably. The goal of an object scope pattern is not achieved merely after compiling since the realization of the purpose is dependent on certain objects being instantiated and assigned to some special variables.
Assuming you are using page 10 of Design Patterns book of GOF - class scope is defined at design time and is built in the structure and relationship of classes where as object scope is defined at runtime and is based on relationship of objects.
精彩评论