I for my part try to:

- use what is already in the model:

  (smartProp.type="String" && smartProp.size> 50) => use largeString

- put as much stuff in the model as possible, eg, I have 
entity.userInfo.SIZE=small|medium|large, which allows me to

  (smartRel.destEnt.userInfo.SIZE='large') => componentName="Whatever"

- use parentEntity.name if possible

Otherwise I *mostly* group like (e=Father && (p=x || p=y)).

>> P.S:  Is it possible to speak about "rule refactoring"?

Sure... it's not like the fight club?!

Cheers, Anjo



Am 12.11.2009 um 21:22 schrieb Mark Wardle:

> Not to hijack this thread but as a related issue, I wish I could add
> comments to my rule files.... It would be so helpful while learning...
> 
> Mark
> 
> 2009/11/12 Szántai Károly <[email protected]>:
>> Hi,
>> 
>> What is the best practices for writing good, _maintainable_ and extendable
>> D2W rules? Especially in the left-hand side.
>> 
>> What do I mean? Let's see a very simple example. Which of the following is
>> more maintainable, more extendable?
>> 
>> This?
>> 
>> 100: entity.name = 'Father' and task = 'edit' and propertyKey = 'firstName'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Father' and task = 'edit' and propertyKey = 'lastName'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Mother' and task = 'edit' and propertyKey = 'firstName'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Mother' and task = 'edit' and propertyKey = 'lastName'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Child' and task = 'edit' and propertyKey = 'firstName'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Child' and task = 'edit' and propertyKey = 'lastName' =>
>> componentName = "D2WEditString"
>> 
>> Or this?
>> 
>> 100: entity.name = 'Father' and task = 'edit' and (propertyKey = 'firstName'
>> or propertyKey = 'lastName') => componentName = "D2WEditString"
>> 100: entity.name = 'Mother' and task = 'edit' and (propertyKey = 'firstName'
>> or propertyKey = 'lastName') => componentName = "D2WEditString"
>> 100: entity.name = 'Child' and task = 'edit' and (propertyKey = 'firstName'
>> or propertyKey = 'lastName') => componentName = "D2WEditString"
>> 
>> Or this?
>> 
>> 100: entity.name = 'Father' and task = 'edit' and propertyKey like '*Name'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Mother' and task = 'edit' and propertyKey like '*Name'
>> => componentName = "D2WEditString"
>> 100: entity.name = 'Child' and task = 'edit' and propertyKey like '*Name' =>
>> componentName = "D2WEditString"
>> 
>> Or this?
>> 
>> 100: (entity.name = 'Father' or entity.name = 'Mother' or entity.name =
>> 'Child') and task = 'edit' and propertyKey = 'firstName' => componentName =
>> "D2WEditString"
>> 100: (entity.name = 'Father' or entity.name = 'Mother' or entity.name =
>> 'Child') and task = 'edit' and propertyKey = 'lastName' => componentName =
>> "D2WEditString"
>> 
>> Or this?
>> 
>> 100: (entity.name = 'Father' or entity.name = 'Mother' or entity.name =
>> 'Child') and task = 'edit' and (propertyKey = 'firstName' or propertyKey =
>> 'lastName') => componentName = "D2WEditString"
>> 
>> Or this?
>> 
>> 100: (entity.name = 'Father' or entity.name = 'Mother' or entity.name =
>> 'Child') and task = 'edit' and propertyKey like '*Name' => componentName =
>> "D2WEditString"
>> 
>> Or this?
>> 
>> 100: (entity.name like '*ther' or entity.name = 'Child') and task = 'edit'
>> and propertyKey like '*Name' => componentName = "D2WEditString"
>> 
>> 
>> I think all of them have pros and cons. The first one is very simple and
>> clean. The last one is very tricky and compact.
>> 
>> What do you think?
>> 
>> 
>> Thanks
>> 
>> Károly
>> 
>> P.S:  Is it possible to speak about "rule refactoring"?
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      ([email protected])
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/webobjects-dev/mark%40wardle.org
>> 
>> This email sent to [email protected]
>> 
>> 
> 
> 
> 
> -- 
> Dr. Mark Wardle
> Specialist registrar, Neurology
> Cardiff, UK
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/anjo%40krank.net
> 
> This email sent to [email protected]

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to