Monday, June 13, 2011

Introduce Role Objects

Introduce Role Objects
It is common practice to implement roles such as Employee, Customer, etc. as subclasses of a common role player class such as Person. However, this means that different instances of the role classes are actually different objects with different state and different identity, even if they are meant to represent the same logical entity. The Role Object Pattern (ROP) addresses this problem by representing an object and its roles as a composition of one role player object (called the core) and arbitrarily many role objects.

No comments:

Post a Comment