• 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: Apple guys: is the XCode generated CD accessor code decent?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apple guys: is the XCode generated CD accessor code decent?


  • Subject: Re: Apple guys: is the XCode generated CD accessor code decent?
  • From: Scott Ellsworth <email@hidden>
  • Date: Fri, 27 May 2005 13:24:32 -0700


On May 27, 2005, at 12:17 PM, Scott Stevenson wrote:


On May 27, 2005, at 11:56 AM, Scott Ellsworth wrote:

int habitability = [testWorld valueForKey:@"atm"] + [testWorld valueForKey:@"hyd"];

This would yield some interesting results. :)

Because I should have written

int habilability = [[testWorld valueForKey:@"atm"] shortValue] + [[testWorld valueForKey:@"hyd"] shortValue];

?

This bolsters my case - the 'work', if you will, is adding the atm and the hyd values and doing something with them. The cruft needed to get those values into things that can be added is mental overhead, and the less, the better.

Do not get me wrong, as you say a paragraph later:

I believe I find it easier because there is just plain less to parse with a direct setter, so it is easier to recognize as a setter/getter by eye.

I like the loose, zen-like quality of KVC. In other words, I'd rather see more KVC messages per line than more total method implementations per project.

There is some appeal to that. I suspect it depends on whether I am writing UI code, where all I want is for IB to magically grab the proper value, or whether I am writing computational code where anything between me and the actual calculation is a chance for error.


There are times when hard-coded accessors make more sense. In either case, I think it's good to wait to create accessors until the design solidifies.

Agreed. I must have fiddled with these attributes a dozen times during development, and I have written this code or something like it a dozen times over the last twenty three years.


The reduced code is a key to Core Data's ability to quickly prototype ideas.

Yep. Though, hearkening back to an earlier discussion, data migration can sometimes be ... interesting.


Scott

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Apple guys: is the XCode generated CD accessor code decent?
      • From: Scott Stevenson <email@hidden>
References: 
 >Apple guys: is the XCode generated CD accessor code decent? (From: Scott Ellsworth <email@hidden>)
 >Re: Apple guys: is the XCode generated CD accessor code decent? (From: Scott Stevenson <email@hidden>)
 >Re: Apple guys: is the XCode generated CD accessor code decent? (From: Scott Ellsworth <email@hidden>)
 >Re: Apple guys: is the XCode generated CD accessor code decent? (From: Scott Stevenson <email@hidden>)

  • Prev by Date: Re: How to get NSTableView to notice a change in NSTableDataModel
  • Next by Date: Re: Apple guys: is the XCode generated CD accessor code decent?
  • Previous by thread: Re: Apple guys: is the XCode generated CD accessor code decent?
  • Next by thread: Re: Apple guys: is the XCode generated CD accessor code decent?
  • Index(es):
    • Date
    • Thread