User Tools

Site Tools


why_must_roles_be_stateless

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

why_must_roles_be_stateless [2014/01/20 02:31]
gazoot created
why_must_roles_be_stateless [2014/01/26 21:11] (current)
jcoplien
Line 2: Line 2:
 **i.e. why are they allowed to contain only methods, and not their own data properties?​** **i.e. why are they allowed to contain only methods, and not their own data properties?​**
  
-We all know that RoleMethods can invoke (data) methods of self. If RoleMethods don't invoke data class methods then they can stand alone: there is no need to inject them into any object. (Remember that we decided to call this the "data class" rather than the "​domain class."​) Turned around, the object must supply the implementation of the data methods expected by the Role. So there is a method symbiosis between the data and the Role: we can view the data class as holding the data for the RoleMethods. That's kind of "DCI 101".+We all know that RoleMethods can invoke (data) methods of ''​self''​. If RoleMethods don't invoke data class methods then they can stand alone: there is no need to inject them into any object. (Remember that we decided to call this the "data class" rather than the "​domain class."​) Turned around, the object must supply the implementation of the data methods expected by the Role. So there is a method symbiosis between the data and the Role: we can view the data class as holding the data for the RoleMethods. That's kind of "DCI 101".
why_must_roles_be_stateless.txt ยท Last modified: 2014/01/26 21:11 by jcoplien