Hi everyone,

I'm creating an app that has a master-detail interface, similar to iTunes. It has the same data hierarchy as iTunes' playlists (except that I'm not allowing groups of "playlists" to keep things simple). In other words, there are normal playlists where their only items are added manually by the user. There are smart playlists, which show all items that match a user-defined predicate. Finally, there are some "playlists" that are not editable at all by the user (I call these "DefaultFolders"), but are in essence nothing more than fancy smart playlists in that their predicate is to show everything. These are like the "Library" and "Movies" sections in iTunes.

In my attempt to recreate this structure, I've come up with the following hierarchy (in Core Data): http://gallery.me.com/davedelong#100084/Screen%20shot%202009-11-07%20at%207.17.53%20PM&bgcolor=black (hopefully it is self-explanatory)

However, as I've gotten further into this app, this structure has become a little cumbersome. For example, I defined an accessor on the AbstractFolder class called - (NSSet *)items, so that all concrete folder types (DefaultFolder, SmartFolder, and Folder) can easily retrieve their contents. This coincides with relationship that the Folder entity has with the Item entity. However, I can't implement the items accessor in AbstractFolder, because that would override the generated accessor provided by Core Data for the Folder Entity. I've thought about making it part of a protocol that all concrete folders would implement, but that seems to defeat the purpose of inheritance.

So I open this up to the collective wisdom of the mailing list. Is there a better way I could model this structure? Have any of you worked on apps with similar structures? What did you find helpful?

Any insights or suggestions you could sure are greatly appreciated.

Thanks!

Dave DeLong

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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 arch...@mail-archive.com

Reply via email to