Re: DataObject and DataObjectList in Jamaica

"[email protected]" <[email protected]> Sat, 11 Apr 2009 16:00:19 +0200
Newsgroups gmane.comp.cms.xaraya.devel
Organization Xaraya
Message-ID <[email protected]>
Marcel van der Boom wrote:

> You are proposing this:
>   Master
>   ↳ Object
>      ↳ List
> with the rationale: 'list is an object with an items attribute added' 
> Right?
> (hope the arrows come thru allright)

Yes
> 
> 
> Two alternatives perhaps worth considering:
> 
> 1. Reverse the inheritance, so:
>   Master
>   ↳ List
>      ↳ Object
> with the rationale: 'object is a list where the items attribute is 
> limited to 1 'thing''

That's a rationale that is intuitive. but I'm less sure that it makes 
sense for the code. I also have the feeling that object is loaded more 
often than objectlist, so there may be a performance consideration.
> 
> 2. Refactor into Items object and Decorate when needed
>   Master
>   ↳ Object
> 
>   ItemList
> 
> with the rationale: 'when we need a list, we decorate Object with an 
> instance of Values and work from there. The latter is actually the same 
> as 1 (because the items attribute would still be needed), but refactored 
> one step further.

Hmm..hadn't considered that one. I wonder if doing it runtime would have 
any performance advantages. Need to think about that a bit.
There are several cases here:
- decorate object with an instance of "ObjectList", adding the list 
methods (showview and friends) and the values of the item(s).
- decorate "ObjectList" which is object plus the list methods with an 
instance of "ItemsList" (which does the adding of the values)

and variants in which methods and property values are in the decorator 
or the decorated instance.

If for no other reason the decorator idea holds some allure (well, for 
me anyway) because it is an abstraction of simply "adding the item 
values", which is what we're doing now.
> 
> I'm just giving them for inspiration, I have no clear preference, still 
> being out of sync with what the current code is.

I'm grateful for the code considerations. I'm also interested in 
anyone's opinion from the point of view of (common) use cases.
> 
> marcel
> 
> PS
> Did I see it right that the branch I pushed without <xar:mlstring/> tags 
> was merged in? (i.e the merge + the many debris revisions?)
> 
yes, that was on my list of cleanups anyway, so it came at a good moment.

Marc
_______________________________________________
Xaraya_devel mailing list
[email protected]
http://xaraya.com/mailman/listinfo/xaraya_devel