• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fault Confusion
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fault Confusion


  • Subject: Re: Fault Confusion
  • From: James Cicenia <email@hidden>
  • Date: Sat, 31 Jul 2004 08:17:02 -0500

Colin -

Thank you for your comments and style suggestion. As far as NSMutableArray goes... I normally have a sort capability in these methods.. this one was lacking it so I don't need to cast to NSMutableArray.. however, in my other classes I offer a sort on one key that I pass and the sorts need a mutable array so I was standardizing on that. I guess I should just make all these methods return a NSMutableArray.

As far as the qualifier goes....I got used to my way and just stayed with it. It became my standard.

Now if I can only figure out why a fetch would work while a filteredArray doesn't I would be very happy. I am starting to think this is a bug in WebObjects.

-James Cicenia

On Jul 29, 2004, at 4:54 PM, Colin Clark wrote:

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.
_______________________________________________
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.


References: 
 >Re: Fault Confusion (From: Colin Clark <email@hidden>)

  • Prev by Date: attempt to assign value to unknown key
  • Next by Date: Re: Related to WO (a little)
  • Previous by thread: Re: Fault Confusion
  • Next by thread: authenticate to opendirectory
  • Index(es):
    • Date
    • Thread