[Enh] MACustomDescriptionBuilder

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[Enh] MACustomDescriptionBuilder

keith1y
I wrote this because I want my data model classes to have one set of
#description's to model their data structure and another set of
#settings to model the view/filter settings that are available for each
class.

I dont know what the best way to achieve this with magritte would be,
but I figured being able to have multiple sets of descriptions for
different unrelated purposes could be very useful.

As an implementation detail, it might be useful if the
MADescriptionBuilder 'Cache' was a class instance var rather than a
classVar.

best regards

Keith

p.s. Lukas, I want to thank you for all of the great help you have
provided, especially in the past few days.


In http://mc.lukas-renggli.ch/pieraddons

Name: Magritte-CustomBuilder-kph.1
Author: kph
Time: 18 August 2007, 2:53:47 am
UUID: dc2d465c-4d2d-11dc-b626-000a95edb42a
Ancestors:

- Variant of MADescriptionBuilder that is not tied to #description as a
prefix.

usage: (MCCustomDescriptionBuilder prefix: #settings) for: anObject

Notes: Includes a performance enhancement to double speed of description
building. (selectors of Object are ignored)

before:
[ 1000 timesRepeat: [MADescriptionBuilder default build: (ProductData) ]
] timeToRun. 21622

after:
[ 1000 timesRepeat: [(MACustomDescriptionBuilder prefix: #description)
build: (ProductData) ] ] timeToRun.  11075




_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: [Enh] MACustomDescriptionBuilder

Lukas Renggli-2
> I wrote this because I want my data model classes to have one set of
> #description's to model their data structure and another set of
> #settings to model the view/filter settings that are available for  
> each class.

Usually I tag my descriptions to do that, e.g. #beEditable,  
#beSearchable, #beSetting, etc. This allows to easily define  
(overlapping) sub-sets of all the existing descriptions.

> I dont know what the best way to achieve this with magritte would be,
> but I figured being able to have multiple sets of descriptions for
> different unrelated purposes could be very useful.

Yes, have a look at the senders and implementors in Pier of  
#beEditable, #isEditable, #beSearchable, #isSearchable, ...

> As an implementation detail, it might be useful if the
> MADescriptionBuilder 'Cache' was a class instance var rather than a
> classVar.

The idea was only to have one builder active in the image.  
Object>>#description uses this default builder. Subclasses might  
override #description to use a different one, if necessary.

> Notes: Includes a performance enhancement to double speed of  
> description building. (selectors of Object are ignored)

I have some projects that add descriptions to Object, so this  
optimization would break certain things.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Enh] MACustomDescriptionBuilder

keith1y

>
> I have some projects that add descriptions to Object, so this
> optimization would break certain things.
>
> Lukas
Following your mail I checked a couple of things, and found a
significant bug in my optimization.....

Putting a breakpoint in #build: when it calls allSelectors shows that it
works through the selectors of the following chain of classes!

PRComponent class
PRStructure class
PRDecorated class
PRObject class
Object class

and also it continues to

ProtoObject class
Class
ClassDescription
Behavior
Object
ProtoObject

If we are only looking at the class side then thats a lot of selectors
which we are not interested in

myPRComponent class allSelectors size 1075.
(myPRComponent class allSelectorsBelow: Object) size. 577
(myPRComponent class allSelectorsBelow: ProtoObject class) size  50.

before

[ 1000 timesRepeat: [MADescriptionBuilder default build: (ProductData) ]
] timeToRun. 21622

after
[ 1000 timesRepeat: [MADescriptionBuilder default build: (ProductData) ]
] timeToRun. 1717

best regards

Keith

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki