Saturday, March 26, 2011

Scala Roles

Not sure how I ever could have missed it, but for some reason the 2008 paper on Scala Roles (think DCI done in Scala) is starting to pop up all over the Internet. I just read it, and it actually looks pretty sensible. Just a couple of things that I haven't been able to figure out yet, and keeping here for future reference.

Disconnected Roles

Without going into too much detail, the general idea is that collaborations are instantiated with their roles. So if I instantiate a ThesesSupervision instance, I get an instance of each of the associated roles for free. These roles are stateful. The Student for instance has motivation and wisdom. The SuperVisor has the capability to advise and grade the Student.

Suppose we have two persons: Peter and Paul. If Paul is Peter's supervisor, then on advising Peter, he basically steps into the role of SuperVisor. In this role, he is able to advise Peter.201103260829.jpg

The corresponding Scala code:

(peter as phd.supervisor).grade

What I found surprising is that grading the roles continue to be unaware of the objects playing the role. Therefore, an action affecting the Student will never affect its 'Personality'. In reality, it obviously will. If I would be a student and get a bad grade, it would affect my personal life as well. My happiness would drop, for instance. The solution outlined in the paper seems to be unable to address that concern.


An updated version of the library is here on GitHub. The original paper can be downloaded here.

1 comment:

  1. Link to the paper is broken. Assuming you mean: ?