No set methods in the API ? (Was: Re: Relationship between Q and STC - Frames & Mapping

Martin Hill mchill at dial.pipex.com
Tue May 11 08:57:22 PDT 2004


Brian Thomas wrote:

> On Tuesday 11 May 2004 06:58 am, Martin Hill wrote:
> 
>>>      I'd also favor having a boolean method to determine the nature of
>>>how the values are generated in a Q also. This is nice because you can't
>>>(shouldn't) do "q.setValue(Obj, Location);" method call on a Q that has a
>>>mapping behind it. The method thus allows the user to pre-determine
>>>whether its OK to make the setValue call rather than having to always
>>>catch an error.
>>
>>I don't think this is a sufficient check; if values shouldn't be set
>>then we shouldn't have a method to do so...  If we can map values out
>>can we normally expect to reverse them back in?  But then I'm not in
>>favour of changing values anyway!
> 
> 	But when you explicitly hold values, you definitely will need a way
> 	to "set" the value of a location (!!). 

:-) Not necessarily - I was really saying that I'm not in favour of 
mutable Quantities.  The values should go in as part of the 
construction/factory method - that way you can never end up with 
inconsistent instances.

However I don't think this is a data modelling issue - this is an 
implementation issue, as some languages might be better or worse at 
providing this.  So I go back to saying that I'd rather see them as 
properties/aggregations not as methods - it better reflects anyway what 
we are doing at this stage.



-- 
Martin Hill
www.mchill.net
07901 55 24 66



More information about the dm mailing list