Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
James Andrews
7,245 PointsWhy not define a model when accessing remote data?
I just finished the Build Self Destructing Message track for iOS. I noticed we rewrite a lot of code in the controller that could have been modularized. Wouldn't it have been better to put all that in a single class? If so, was there a reason for not doing so? Also in the previous part of iOS track Emit talked about using the model for model data. Why did we not implement a model class in Ribbit? Is Parse's library considered the model?
1 Answer
Misha Shaposhnikov
8,718 PointsIndeed, Parse is the model in this app. The Parse Dashboard is a great example of how Parse acts as the model. There is simply data that is stored in a dictionary and nothing else. All we are doing when using the Parse API is directing that data to and from the Parse model with our controllers and placing that data in a view with the inbox, friends, and camera views.
Parse is already very well built, so there is no need to make our own child classes of the Parse classes or anything like that, and though it may seem like repetition, we are working with specific instances of view controllers, so there is no neat way of encapsulating all the similar functionality of our view controllers in a separate class. It's better just to use the methods that are given. =)
Happy Coding!
James Andrews
7,245 PointsJames Andrews
7,245 PointsI don't know I guess I see a lot of calls to parse from the different view controllers that were the same, ie getting friends etc, that could have made a common function in a class, but I do see what you're saying.