MobileMakers Week 4 Day 1
Data Modeling, Model-View-Controller
Welcome back to another day at MobileMakers. Today was the first day of week 4. Following up on the weekend challenge, I was able to finish all the required steps except for displaying the pins in the map. This is due primarily because i’m getting “0” for both latitude and longitude so my pin appears some place near Africa. I’m going to have to spend some time on it during the week and make it work.
I also have to dedicate some time to review all of last weeks videos and get some clarification on certain things. My main issue is still wrapping my head around custom delegation. I get the idea of it but knowing where to implement it is what gets me.
This morning was super light. We got a super brief keynote on data modeling and we refactored one of last week’s hackwhich to MVC.
We learned what data modeling is and how it can help us to constructevely discuss and decide on what set of class methods your data model will be made out of. We also learned how data modeling helps us to identify relationships between these objects, write code to reflect the decisions previously made, make decisions based on the Model-View-Controller design pattern and write business logic into the model object in which it pertains.
Well all that is fine and dandy, but what is Data Modeling? Data modeling is the process of defining classes of objects in order to represent the data our application needs. So.. in English, a data model are the nouns fo the application and how they connect. For example, imagine for a second we own a stock trading application. The data model (nouns) will be the stock, the company and the portfolio.
Model View Controller (MVC)
This MVC is widely discussed in the world of iOS, in fact, iOS was built on MVC. What is MVC you ask? Well MVC is a design pattern. A design pattern which happens to be the recommended design pattern for iOS Applications.
This design pattern clearly defined the roles of objects and how the communicate. The Model-View-Controller pattern emphasizes that all “Business Logic” for a model object should reside in that model object’s class.
Simply put, business logic is any logic that enables CRUD.
For this morning class, we simply created a model object by subclassing NSObject. Our model had three properties, one class method, one instance method and one instacetype initializer.
Our class and instance methods had a completion handler and we refactored our reused code from our main view controller and moved it to our model.
Here is the link in GitHub
Well, like I said, today was super light. For the afternoon challenge, we needed to refactor a base project that you we were given and implement either class or instance methods in our model objects. The decision of wether to make it a class or instance method that was done by the instructions.
So for that same reason, there will be no code displayed today and rather I would only share the link in GitHub.
Here is the link in Github.