How To Build iPhone Apps – S01E03: iOS Architecture Model View Controller (MVC)

hey everyone welcome to episode three of how tobuild iphone apps and today we’re going to go over at the MVC software designpattern otherwise known as model view controller and the reason why this is important isbecause all the ios apps that you will bebuilding will be leveraging this software design pattern to lend itself to bettermaintainability and more usability and you know all that good stuff so it’s very simple once you cross theconcept but MVC stands for model view controller and those represent three distinct jobs and all of the objects in your applicationwill have one of these jobs they’re either model view controller or maybe some other classes but for the most part of these are the mainthree actors in our application so let’s go over what their roles are within your application so model which talked about that and whatit represents is your data in your application as well as all of the business rules and all of the logic andmanipulation associated with that data and view or views in your application pretty self-explanatory all of the formsand labels and you know basically that visualrepresentation to the user and finally controller and thecontroller sits inbetween the model and the view and facilitates communication between thetwo and the model and the view never directly talk toeach other and so in this way you have three very distinct layers ofabstraction and this lends itself to more reuseability because you can swap out these actorsand you know they have very definedroles that’s the idea at least so let’stalk about the communication flow between these three actors so first of all uh…Your model represents the data and whenever that model gets updated ormaybe gets fresh data or changes or something like that it notifies the controller now the controller then in turn updates view which is what the user sees now the reverse is true know the user interacts with your data sorry interacts with yourapplication the controller captures that user interaction and then in turn it updates the model and so you can see this circular communication flow is mainly what happens in yourapplication however the model never communicatesdirectly with the view and that’s just the rule within this MVC pattern so there it is, it’s a very abstractconcept what we’ve talked about here but it’s gonna be more concrete when we start to work within our iphone demo and when i mention things like view orviewcontroller or model you’re going to be able to holdthis diagram in your head and have a visual uh… visual diagram of where those files sitwithin these three jobs all right that was a quick one so until episode four i’ll talk to guys soon, bye

Related posts