Reputation: 26223
A quick question, is it ok for the controller to contain a pointer to a model object so that it can use an instance method to alloc and then call the model as needed. Or is it best to set the model up as a singleton and then use a static pointer / class method to access the model as needed. Or either, it simply does not matter?
Just curious as I have used both, one ties the model to the controller, whilst the other leaves the model more independent but means it can be accessed from anywhere?
Cheers gary.
Upvotes: 1
Views: 157
Reputation: 135548
It is perfectly normal for the controller to hold a pointer to the model. After all, interacting with the model is one of its most important jobs. IMO, singletons should be avoided in most cases unless you have a very good reason to use them.
Upvotes: 3