Re: spaghetti code with core data and multiple views
Re: spaghetti code with core data and multiple views
- Subject: Re: spaghetti code with core data and multiple views
- From: Christopher Campbell Jensen <email@hidden>
- Date: Tue, 14 Jul 2009 11:14:50 +0200
On 14 Jul 2009, at 09:11, email@hidden wrote:
In terms of the app delegate, window controllers and view controllers,
it sounds like you've done things perfectly for your given user
interface design.
In terms of the "narrowed down" set of data, you haven't quite thought
your MVC design through.
What you have discovered is, for your application design, the desired
data model is *not* the core data managed object context, but a
smaller abstracted object graph.
Think of your data model as the narrowed down data, which is (as an
implementation detail of the data model itself) backed by the core
data managed object context. Your data model consists of (I'm
simplifying, of course) three collections: the set of core data
entities your user wants to choose metadata types for, the
corresponding set of metadata values for each type (for populating
your popups), and the set of data values for each metadata value.
It's not clear if these three collections will themselves need to be
saved somewhere, for the next time the user runs your application. If
so, you could save this information as another set of core data
entities, ready for fetching the next time your application starts. If
not, then these collections are just objects you keep in memory and
throw away as soon as the movie is re-written.
Is that any help?
Thanks for the kind words :)
The three collections of data will not be saved for the next
application run; the selections made will either be written to the
file, or discarded when the application runs. This means that the
persistent data will only be the original superset, ie. the "cached"
data from the online sources. If the user makes all his selections,
then quits the app without saving the data to the file, he will have
to go through the same hoops (search, select from popups, fine-tune in
textboxes) to get back to the same state as previously.
So what is needed is for me to be able to pass this "narrowed down
data" from one view to another in a way so that the next view can make
changes/further refinement before passing it on to the next one.
Now the question is, how do I do this? Will I have to either:
1. Create connections between the three sub-views by creating them
all, then passing in pointers to the other two to each of them?
2. Each view passes the current "narrowed down data" back to the super-
view (MainViewController), and have him pass it on to the relevant sub-
views
3. Can this "narrowed down data" be somehow temporarily stored in core
data so that each view only has to access the MOC and ask for the
current "subset"?
I am sure it is becoming pretty clear that I really don't have my head
wrapped around how core data functions, and it's abilities. My reasons
for choosing to use core data, is it seemed the most sensible way to
achieve easy lookup of data together with persistent storage. Plus
it's one of the core frameworks, and makes sense to me to maximize my
learning benefit by not avoiding them :)
Thanks
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden