Basically what Farrukh said… DRY: Don't repeat yourself :-) Make rules as specific as necessary, but no more. When you see yourself creating a lot of rules that do essentially the same thing for different cases, try to create a single rule that covers them all. A rule like
(propertyType = 'r' and relationship.destinationEntity.name = 'MyEntity') => keyWhenRelationship = "someAttribute" Covers every possible relationship to MyEntity, so you only have to specify it once as opposed to specifying it for each entity.name & propertyKey pair that goes to MyEntity. But in this case, if you just override userPresentableDescription() on MyEntity, you never even have to specify a rule for this key in the first place… so that's better still. In other cases, you can apply logic to your rules in a custom assignment. A custom assignment allows you to create lots of different values for a single key using a single rule. That way, all your rule logic is back in familiar java code. When you start writing your own custom assignments, you begin to see custom rules as overrides or exceptions to the rule :-) There are lots of awesome custom assignments already available in wonder, but your business logic may dictate that you need to make a few of your own. See: http://wiki.wocommunity.org/display/WO/The+D2W+Rule+System And my WOWODC presentation on custom assignments for more info. Ramsey On Feb 8, 2012, at 5:29 AM, Farrukh Ijaz wrote: > Well if you have many many rules then you should revise them, sometimes it's > easy to write one rule instead of multiple, e.g. you have boolean property > and what to display a D2WDisplayBoolean component whenever it's in the select > or inspect task. Here is how I'll go with this: > > Adapt name convention for the property key something like 'isActive', > 'hasSomething', 'shouldContain" etc. > > 100: LHS: (propertyKey like 'is*' or propertyKey like 'has*' or propertyKey > like 'should*') and (task = 'select' or task = 'inspect') > RHS: componentName = 'D2WDisplayBoolean' > > instead of individual rule for entities, tasks and pageConfigurations for the > same purpose. > > And then for special case I can add another rule with additional > qualification or 50 points higher priority. > E.g. > > 150: LHS: (propertyKey = 'shouldShowSpecialyComponent') and (task = 'select' > or task = 'inspect') > RHS: componentName = 'SpecialD2WDisplayBoolean' > > Trust me this way you can reduce thousands to hundreds. > > Additionally you can group various model files under a single group, this way > you can find duplicates and update multiple files together I believe. > > <Screen Shot 2012-02-08 at 3.27.49 PM.png> > > > On 2012-02-08, at 3:00 PM, Theodore Petrosky wrote: > >> How do youse guys who have experience handle rules files that grow. I >> realize that I am still a neophyte and I have a lot to learn about using (*) >> to reduce the number of rules. However, I see that as a small project gets >> even medium sized there are so many rules. >> >> I have trouble finding the rule I want to work on. Multiple rule files? >> using the priority to group rules together? >> >> I want to find a good direction. >> >> Ted >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list ([email protected]) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com >> >> 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: > https://lists.apple.com/mailman/options/webobjects-dev/ramseygurley%40gmail.com > > 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: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
