User Tools

Site Tools


why_can_t_i_reuse_a_role_across_multiple_contexts

This is an old revision of the document!



Why can't I reuse a role across multiple contexts?

This has been discussed many times on the Email list; a review of the treatment of the topic there might also be informative.

A role is a name with associated responsibilities. That makes sense only in a Context. A Shape can move and draw in a graphical context; a Cowboy can move, draw and shoot in a Western movie context. Having a role — named however you like — that can draw and shoot does not make it a candidate for reuse in another context.

The Context meaningfully associates objects with its roles so that the objects — which do the work — fit the overall Context goal (use case goal). If a Role spans Context, it lacks the, er, contextualization for it to make sense in a given Context.

From a software engineering perspective, DCI is about readable code. I want to be able to modify a Context locally, understanding its real and latent relationships to other roles in that Context. If a Role exists in multiple Contexts, I can't do that.

See the discussion on “habits” in the Lean Architecture book. They are decontextualized algorithms that don't rise to the criterion of being a use case (system operation). Maybe, in theory, you could reuse a role across multiple habits, but I can't imagine why one would want to do that.


why_can_t_i_reuse_a_role_across_multiple_contexts.1389807208.txt.gz · Last modified: 2014/01/15 17:33 by jcoplien