definitive guide for model implementation, top level connections?
definitive guide for model implementation, top level connections?
- Subject: definitive guide for model implementation, top level connections?
- From: Darren Minifie <email@hidden>
- Date: Sun, 15 Mar 2009 00:30:50 -0700
Hi Everyone
I was hoping that somebody could point me in the direction of a source that
best explains how to implement the model in the MVC pattern, and how to make
top level connections between the model and and controllers. Many of my
programs wind up in the scenario where a root controller owns some other
controllers, and one of the sub-controllers needs data held by the other.
This usually ends up with me grabbing the shared NSApp instance and making
my way to the data from there. this has to be wrong, but i'm unsure how to
refactor. I also read a recent blog that said to avoid putting much of
anything in the NSApplication delegate. This has made the process of
getting started difficult for me, from a desing point of view.
I was also hoping that more experience developers could comment on my basic
process for starting a new project:
1. Create a root controler. An instance is loaded by the main Nib file and
is the NSApplication delegate.
2. Create my main window layout in the main nib file.
3. Create any subcontrollers I need and make them owned by the root
controller created in (1)
4. Create various model classes to represent data.
5. Create a single model class to act as the root for all other model
objects. I usually call this class someting like kernal or system, and I
create a single instance of it in the root controller class.
A couple of notes before you rip me apart (and that is welcome too, I'm
still learning).
- I'm usually thinking about the model and controllers at the same time, and
write them somewhat concurrently.
- I'm not yet interested in core data. I know it would help, but i want to
understand this stuff before I go there.
- I've often considered making the object described in (5) (the root model
class) a singleton class that is shared everywhere in the app. Is this
appropriate? This is pretty much the root of my problems/questions. How to
best share the model's data with the various controllers.
Thank you all for your help and 2 cents on this.
--
Darren Minifie
Graduate Studies: Computer Science
www.myavalon.ca
www.ohsnapmusic.com
_______________________________________________
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