MVCS - questions


#1

I am not totally sold on this new MVCS paradigm thats at the end of this chapter.

The model(BNRItem) class could have easily handled everything that the itemStore and the imageStore did(create items, connect to the documents directory and load images, etc). I suppose that if you wanted to create a generic imageStore class to hold all images in memory then that make more sense. Thats something that i can see being useful for any application that uses UIImage manipulation. I guess if i were writing this, createItem: and removeItem would have been one of my first methods to write for BNRItem. But then again, maybe I am all wrong here.

I, personally, have never had my controller save or load model objects. I thought the whole point of the MVC paradigm was that the controller would go to the model to get data and the model would get that data from a filesystem, database, or wherever and give that to the controller.

[quote]
A store exposes a number of methods that allow a controller object to fetch and save model objects. The details of where these model objects come from or how they get there is left to the store.[/quote]

Again i thought that’s what the model in the MVC paradigm was supposed to be doing anyway??

Maybe i read this part wrong. maybe i am wrong. I am open to discussion because i want to continue to learn. Lets talk. :mrgreen:


#2

Paradigms are luxuries which can be afforded unless they infringe on the guiding principles of safety, correctness and efficiency.


#3

At this point, with such simplistic saving, fetching and model objects, we aren’t gaining much by moving the logic into the store. In later chapter, the store will become more useful.

However, a model object should never be initiating writing to or reading from an external source. They aren’t supposed to understand the complexities of the application. In platforms like Ruby on Rails, they have the idea of “fat model, skinny controller”, where model objects are really the ones in charge. This doesn’t work so well for iOS.


#4

I should also add: every single time I’ve put store-like behavior on a model object, I’ve ended up having to move it to a store. Model objects are just too removed from the application logic to rely on them to understand filesystems and web services.