MVC – Model Object Class – Presence2 Stanford CS193P

I have been struggling for days with this concept which only became apparent in Presence 2, not so in HelloPoly. Ive read the ObjC literature and read about creating class files for data you are customizing or creating. For some reason i thought creating a Class File like Person Object Class or Polygon Object Class meant that i created a ‘container for my data’ and then filled it up. This implied that the Person Class would serve as a DataStore for my persons.

From what i now understand, from looking at the from Apple is that its actually just a ‘mold’ for data, not really a store. I kinda see it like one of those cookie cutter shape molds or a pasta maker thingamajigger where you FORCE your cookie dough, pasta mix or data into the shape or structure you want. But then, and this is the important part, you remove the mold and store the actual data somewhere else. In they create a Play Class which tells the program that the object Play is to be stored with title, genre, date and even characters. Then a DataController class file, is where the data in this case is hardcoded by saying instantiante a Play, set title, genre, date, and characters (which is actually an array or people) and this is one object instance, put it into an array, and then release the Play mold so that someone else can use it.

So this means when you want to get your data, you actually get at your array, not at your Play object directly. For some reason i thought you had to call Play.RomeoandJuliet or Play.JuliusCaesar or Play where title = Othello in order to get the information out. So i was complicating myself trying to write code that i assume doesnt exist and on top of it all thinking the use of an array to put the data into was redundant or inefficient.

In HelloPoly we create the Polygon Class Object which is the mold for the data we want to store, which is really just numberOfSides. We created a Controller Object in the nib which i understand connects the polygonview to the polygonshape object; would this be equivalent to a TableViewController for a TableView and a plist file in twitter Presence2 app?

And we create 1 polygonshape instance at init and then just update the same instance with new numberOfSides, we dont create new ones.

The model is in fact an object like an array.

And it is a very clear cut division between model and view.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s