SV: SV: Modeling properties and associations explicitly
2008-01-01 09:21:29 GMT
I definitely missed the cleverness(Continue reading)This will work fine, as long as you trust the client not to cast anything and access methods on the implementing class! This should not be a problem since there is always a 'zone of trust' where you dont expect evil clients - and this code will definitely execute within such a zone. /Tomas -----Ursprungligt meddelande----- Från: domaindrivendesign <at> yahoogroups.com [mailto:domaindrivendesign <at> yahoogroups.com] För Rickard Öberg Skickat: den 19 december 2007 14:27 Till: domaindrivendesign <at> yahoogroups.com Ämne: Re: SV: [domaindrivendesign] Modeling properties and associations explicitly Tomas Karlsson wrote: > *** My note *** This looks a little like Ruby on Rails, and I really > like your proposal. If you introduce ReadableProperty, I think it > should be possible to change from within the entity but not from > external code. (I dont know how this can be solved in Java?) This is entirely doable with the help of dependency injection and a little cleverness. Like so: interface Order { ReadableProperty<int> totalPrice(); void addLineItem(LineItem item);
This will work fine, as long as you trust the client not to cast anything
and access methods on the implementing class! This should not be a problem
since there is always a 'zone of trust' where you dont expect evil clients
- and this code will definitely execute within such a zone.
/Tomas
-----Ursprungligt meddelande-----
Från: domaindrivendesign <at> yahoogroups.com
[mailto:domaindrivendesign <at> yahoogroups.com] För Rickard Öberg
Skickat: den 19 december 2007 14:27
Till: domaindrivendesign <at> yahoogroups.com
Ämne: Re: SV: [domaindrivendesign] Modeling properties and associations
explicitly
Tomas Karlsson wrote:
> *** My note *** This looks a little like Ruby on Rails, and I really
> like your proposal. If you introduce ReadableProperty, I think it
> should be possible to change from within the entity but not from
> external code. (I dont know how this can be solved in Java?)
This is entirely doable with the help of dependency injection and a
little cleverness. Like so:
interface Order
{
ReadableProperty<int> totalPrice();
void addLineItem(LineItem item);
RSS Feed