Re: Best Way® to test for existence of a relationsh ip
Re: Best Way® to test for existence of a relationsh ip
- Subject: Re: Best Way® to test for existence of a relationsh ip
- From: Chuck Hill <email@hidden>
- Date: Mon, 7 Apr 2008 08:26:15 -0700
On Apr 7, 2008, at 7:36 AM, Mike Schrag wrote:
I'd expect the instanceof check will be much more efficient than
catching an exception.
By far ...
From an OO design point of view, I'd add a billsOfMaterial() method
to the Part class that simply returns NSArray.emptyArray.
ManufacturedPart will then override this to return the correct
result for a ManufacturedPart.
Ew gross ...
Less gross than doing instanceof, hands down.
If it's not an attribute of all Parts, then from an OO design
standpoint it shouldn't be on Part. I agree if your argument is
based on "the convenience of being able to call billsOfMaterial on
the entire array," though.
The real question is whether it makes sense in the domain for a Part
to have a bill of materials. The default implementation could be
public NSArray billOfMaterials() { return this; }
With complex parts overriding it as appropriate. It could just be
that the model / design is incomplete and leading David into doing Bad
Things in code.
Otherwise, (a) the model is just wrong, or (b) David's processing is
just wrong.
Chuck
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden