[RT] Lifestyle contract

Niclas Hedhman niclas at hedhman.org
Sun Jan 23 15:22:18 EST 2005


On Sunday 23 January 2005 20:11, Stephen McConnell wrote:

> Lisa is a named and
> identifiable service. Let's make the grossly sexist assumption that Lisa
> can cook.  So the service would be to "cook up a meal", or "mix a
> cocktail", or whatever.  If I select "singleton" = does this mean Lisa
> cannot mix more than one cocktail at the same time? Or does it mean that
> Lisa cannot mix and cook at the same time?  Or does it mean that Lisa can't
> cook while she's drinking (or the inverse - can't drink while cooking)? All
> of which should be taking into context - does Lisa have a license? Does
> Lisa have to drive in order to cook?  If Lisa drives, is she still allowed
> to cook? Is "allowed" a concept that is intrinsic to Lisa or is it imposed?
>  Does Lisa have free will? Can Lisa drive, cook, and drink cocktails at the
> same time?

Are you drunk?

> Ok - so who is Lisa anyway?

My mother, can't you read the assembly...


> I think your mixing up the notion of identity with the implementation
> strategy related to service delivery.
>
> Consider the following:
>
>   <component
>      name="lisa"
>      class="org.hedhman.family.Person"
>      creation="singleton"
>
> In this context what does "singleton" imply?  Presumably it is an assertion
> by an assembler that there is only one component that is representing Lisa.
> OK - what does that mean and why is it valuable?

No, Person is the Service. lisa is a component that only exist in a single 
instance (a.k.a singleton).
In the given example, service Person is perhaps always a singleton.

Take the statemachine as an example (since I am working on that right now). Is 
that a singleton or a transient component? That depends where it is used, not 
on how it is written. How it is written, defines its requirement and 
capabilities.


Cheers
Niclas




More information about the dev-dpml mailing list