Hi-

On Sep 15, 2008, at 2:55 PM, Sean McBride wrote:

b) add an attribute named 'index' (value 1 to 6) and code methods named
employee1, etc. in my NSManagedObject subclass?

Certainly do the second one, unless there's some factor in your business logic that demands exactly six employees, but I can't imagine a situation where doing the to-many would be less good. First rule of database normalization: never have repeating fields, and any time you have an ordinal in a column name that's exactly what you're doing.

In order for these employees to always appear in the same order, you display them in a NSTableView bound to an NSArrayController with a sort descriptor set on your "index" key. Also, take a look at this on how you can implement drag-and-drop reordring on your array controllers, as well...

http://hmdt.jp/archives/image/2005_11/DNDCoreData.pdf

This might remove the need for you to have messy -employee[1-6] methods on your Department object. The only reason I might do your first suggestion, where you have 6 relations, is if those relations actually had a business identity or meaning, like 1 was always "Manager," 2 was always "Shift Supervisor," etc. But even then I'd avoid locking myself down to a fixed number of roles per department, since these can change with reorganizations.


Jamie Hardt
The Sound Department
http://www.soundepartment.com/
http://www.imdb.com/name/nm0362504/

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to