Re: Fault Confusion
Re: Fault Confusion
- Subject: Re: Fault Confusion
- From: Colin Clark <email@hidden>
- Date: Thu, 29 Jul 2004 17:54:19 -0400
Hi James.,
I'm afraid I haven't had the time to look at your code more closely to
find out where your problem is. Perhaps you'll find writing some unit
tests for this code will be helpful in doing your refactoring and in
isolating this specific problem?
From a quick glance, though, there a few stylistic issues that are
making your code more difficult to read than it needs to be. I hope
it's not presumptuous of me to make a few suggestions.
On Wednesday, July 28, 2004, at 06:11 PM, James Cicenia wrote:
public NSArray initiatedProjectsByMetricList(PortfolioMetricList
pPortfolioMetricList){
NSMutableArray results;
...
results = (NSMutableArray)
EOQualifier.filteredArrayWithQualifier(this.projects(),andQualifier1);
return results;
}
You don't need to define results here at all because you don't end up
using it; you just assign it and return it immediately. In fact, Your
method signature returns an NSArray and filteredArrayWithQualifier()
also returns an NSArray, but for some reason you define results as an
NSMutableArray and end up doing unnecessary casting. At the end of your
method, you assign results and then return it immediately.
You can simplify things a lot by just going ahead and return the
results of the filter directly, without bothering to define results at
all:
return
EOQualifier.filteredArrayWithQualifier(this.projects(),andQualifier1);
EOQualifier qualifier1;
NSMutableArray args = new NSMutableArray();
args.addObject("portfolioMetricLists");
args.addObject(pPortfolioMetricList);
qualifier1 = EOQualifier.qualifierWithQualifierFormat("%@ = %@",
args);
I think you'll find EOKeyValueQualifiers are much less verbose to work
with. Here's the same functionality in one line of code:
EOQualifier metricListQual = new
EOKeyValueQualifier("portfolioMetricLists",
EOQualifier,QualifierOperatorEqual, pPortfolioMetricList);
I know these suggestions don't solve your problem, but I hope the
simplification will help you a little bit while troubleshooting.
Best,
Colin
---
Colin Clark
Dynamic Web and Database Development Lead,
Resource Centre for Academic Technology,
University of Toronto
(416) 946-7592 / email@hidden
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.