[Dev] Action items from collections code/design review
Ted Leung
twl at osafoundation.org
Mon Sep 19 14:59:44 PDT 2005
On Sep 19, 2005, at 2:08 PM, Phillip J. Eby wrote:
> At 01:31 PM 9/19/2005 -0700, Alec Flett wrote:
>
>> Ted Leung wrote:
>>
>>> One of the items is to move away from use of onValueChanged and
>>> go back to using constructors for creating various collection
>>> kinds. Unfortunately, this
>>> means that we wouldn't be able to use update to change existing
>>> instances in the repository.
>>>
>>
>> As I recall, the issue around this was that if we marked an
>> attribute as "readonly" then there wasn't an obvious way to
>> actually initialize that attribute. If Andi can give us a way to
>> initialize the attribute, and tell Phillip about it so he can make
>> the schema stuff initialize correctly, then can't we make
>> 'sources' be readonly?
>>
>> Also, I just today noticed InclusionExclusionCollection's 'setup'
>> method. I'm curious why some of this stuff can't be just set in
>> the constructor? I think this is kind of tied up in this
>> onValueChanged/readonly sources issue, which is why I bring it up.
>> I'm hoping maybe pje will have some brilliant idea how to get rid
>> of 'setup' because it kind of breaks our model of just using
>> 'update' to initialize and create items.
>>
>
> I've been kind of thinking that allowing attributes' defaultValue
> and initialValue to be functions instead of values would solve this
> and eliminate other kinds of constructor fiddling that currently
> exist. Beyond that, this specific problem really needs a sort of
> "derived attribute", which would be a useful feature to have in
> general.
>
> Anyway, I don't have any ideas that are more than half-baked on
> this at the moment, so I'm inclined to say we should stick with
> what already works for the time being. The TDD folks like to say
> they want "clean code that works", but they also point out that you
> have to start with the code that works, and *then* you clean it.
> It doesn't work so well the other way around. :)
+1
More information about the Dev
mailing list