MVC Design Question
MVC Design Question
- Subject: MVC Design Question
- From: vance <email@hidden>
- Date: Mon, 10 Mar 2008 13:01:50 -0700
If you would design an IM client using MVC, where would the connection
object be?
Here is an example:
The Model:
// Interface Builder has an instance of IMBuddyList
// IMBuddyList is the model that contain a list of IMPerson instances
@interface IMBuddyList : NSObject {
NSMutableArray *buddies; // IMPerson
}
@end
@interface IMPerson : NSObject {
NSMutableDictionary *personDetails; // Name, status, picture...
}
@end
The View:
// The buddyList outlet is connected to the Interface Builder
instance of IMBuddyList
@interface IMBudyListView : NSView {
IBOutlet IMBuddyList *buddyList;
}
@end
My question is where would you put the network connection instances
(NSStream getStreamsToHost) and why so that it incorporates within the
MVC pattern given the two general requirements below:
1. I imagine that the IMBuddyList will need one network connection
instance to get and manage the buddy list from the server.
2. Also I believe each IMPerson should have there own connection as
well (create on demand) for things such as file sharing. (I know that
this will not always work if both clients are behind a firewall but
lets ignore it for this example)
I am not very sure where should the connection object go, the model,
the controller or somewhere outside the MVC architecture. And how the
interaction between the MVC and the network object is if somewhere
outside.
Thank you for the feedback!
Vance
_______________________________________________
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