SlideShare a Scribd company logo
1 of 12
Class 2 – Introduction to Objective C

• MVC – Model View Controller is an architectural pattern that splits
interactions between users and applications into three roles:

                                     Controller
                                    (User input)


                 View                                         Model
            (User interface)                              (business logic)


 • Model - What your application is (but not how it is displayed).
 • Controller - How your Model is presented to the user (UI).
 • View – Your Controller’s minions.
MVC - Model View Controller

                          Controller
                         (User input)



           View                             Model
      (User interface)                  (business logic)




It’s all about managing communication between
camps.
MVC - Model View Controller


                             Controller
                            (User input)



             View                                  Model
        (User interface)                       (business logic)



Controllers can always talk directly to their Model
Controllers can also talk directly to their View
The Model and View should never speak to each other.
MVC - Model View Controller

                                Controller
             ?                 (User input)



               View                                       Model
          (User interface)                            (business logic)



 Can View speak to its Controller?
 Sort of. Communications is “BLIND” and structured.
MVC - Model View Controller

                 target
                                 Controller
                                (User input)

   action
               View                                Model
          (User interface)                     (business logic)



 The Controller can drop a target on itself.
 Then hand out, an action to the View.
MVC - Model View Controller

                   target         Controller
                                 (User input)

          action
                  View                                  Model
             (User interface)                       (business logic)
 will

        should     did


 Sometimes the View needs to synchronize with the Controller.
MVC - Model View Controller
                                                        did
                                            will

              target                Controller                  should
                                   (User input)

   action
               View                                          Model
          (User interface)                               (business logic)


 The Controller sets itself as the View’s delegate.
 The delegate is set via a protocol (i.e. it’s “blind” to class).
 Views don’t own the data they display.
 So, if needed, they have a protocol to acquire it.
MVC - Model View Controller
                                                  did
                      target           will

             count              Controller               should
            data at            (User input)


  action
              View                                    Model
         (User interface)                         (business logic)


 Controllers are almost always that data source (not Model).
 Controllers interpret/format Model information for the View.
MVC - Model View Controller
                                                  did
                       target           will

              count             Controller               should
            data at            (User input)
                                                        ?
  action
              View                                    Model
         (User interface)                         (business logic)


 Can the model talk directly to the Controller?
 No. The Model is (should be) IU independent.
MVC - Model View Controller
                                                 did
                      target          will

             count             Controller               should
           data at            (User input)
                                                                 Notification &
                                                                      KVO
  action
              View                                   Model
         (User interface)                        (business logic)


 So what if the Model has information to update or something?.
 It uses a “radio station” – like broadcast mechanism.
MVC - Model View Controller
                                                   did
                       target           will

             count              Controller                should
            data at            (User input)
                                                                    Notification &
                                                                         KVO
  action
              View                                     Model
         (User interface)                          (business logic)


 Controllers (or other Model) “tune in” to interesting stuff.
 A View might “tune in”, but probably not to a Model’s “station”.
 Now combine MVC groups to make complicated programs… :P
Objective C

•    New language to learn
      – Stick superset of C
      – Adds syntax for classes, methods, etc.
      – A few things to “Think differently” about (e.g. properties, dynamic binding).

•    Most important concept to understand today: Properties.
      – Usually we don’t access instance variables directly in Objective-C.
      – Instead, we use “properties”.
      – A “property” is just the combination of a getter method and a setter method in a class.
      – The getter has the name of the property (e.g. “myValue”)
      – The setter’s name is “set” plus capitalized property name (e.g. “setMyValye”)
     (To make this look nice, we always use a lowercase letter as the first letter of property name.)
     We just call the setter to store the values we want and the getter to get it. Simple!!

•    This is just your fist glimpse of this language
      – We’ll go much more into the details next class.
      – Don’t get too freaked out by the syntax at this point ;)

More Related Content

Viewers also liked

Mailing, the developer's eye view
Mailing, the developer's eye viewMailing, the developer's eye view
Mailing, the developer's eye viewVioleta Salas
 
Como integrar social media en su Organización
Como integrar social media en su OrganizaciónComo integrar social media en su Organización
Como integrar social media en su OrganizaciónVioleta Salas
 
Mobile marketing & Business
Mobile marketing & Business Mobile marketing & Business
Mobile marketing & Business Violeta Salas
 
Mobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsMobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsVioleta Salas
 
SEO Trends 2015 - Tendencias clave para lograr el éxito en este 2015
SEO Trends 2015 - Tendencias clave para lograr  el éxito en este 2015SEO Trends 2015 - Tendencias clave para lograr  el éxito en este 2015
SEO Trends 2015 - Tendencias clave para lograr el éxito en este 2015Violeta Salas
 
PayU Latinaomerica Métodos de pago Online
PayU Latinaomerica Métodos de pago OnlinePayU Latinaomerica Métodos de pago Online
PayU Latinaomerica Métodos de pago OnlineVioleta Salas
 
Find your true passion and do what you love to do
Find your true passion and do what you love to doFind your true passion and do what you love to do
Find your true passion and do what you love to doVioleta Salas
 
Orchestrate Your Attitude - Get the Best from Yourself & Others
Orchestrate Your Attitude - Get the Best from Yourself & OthersOrchestrate Your Attitude - Get the Best from Yourself & Others
Orchestrate Your Attitude - Get the Best from Yourself & OthersYang Ao Wei 楊翱維
 
Self discipline - Brian Tracy
Self discipline - Brian TracySelf discipline - Brian Tracy
Self discipline - Brian TracyVioleta Salas
 

Viewers also liked (10)

Mailing, the developer's eye view
Mailing, the developer's eye viewMailing, the developer's eye view
Mailing, the developer's eye view
 
Como integrar social media en su Organización
Como integrar social media en su OrganizaciónComo integrar social media en su Organización
Como integrar social media en su Organización
 
Mobile marketing & Business
Mobile marketing & Business Mobile marketing & Business
Mobile marketing & Business
 
Mobile Marketing and Social Campaigns
Mobile Marketing and Social CampaignsMobile Marketing and Social Campaigns
Mobile Marketing and Social Campaigns
 
SEO Trends 2015 - Tendencias clave para lograr el éxito en este 2015
SEO Trends 2015 - Tendencias clave para lograr  el éxito en este 2015SEO Trends 2015 - Tendencias clave para lograr  el éxito en este 2015
SEO Trends 2015 - Tendencias clave para lograr el éxito en este 2015
 
PayU Latinaomerica Métodos de pago Online
PayU Latinaomerica Métodos de pago OnlinePayU Latinaomerica Métodos de pago Online
PayU Latinaomerica Métodos de pago Online
 
Find your true passion and do what you love to do
Find your true passion and do what you love to doFind your true passion and do what you love to do
Find your true passion and do what you love to do
 
Orchestrate Your Attitude - Get the Best from Yourself & Others
Orchestrate Your Attitude - Get the Best from Yourself & OthersOrchestrate Your Attitude - Get the Best from Yourself & Others
Orchestrate Your Attitude - Get the Best from Yourself & Others
 
Self discipline - Brian Tracy
Self discipline - Brian TracySelf discipline - Brian Tracy
Self discipline - Brian Tracy
 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
 

Similar to Class 02 Objective C

Code Camp 06 Model View Presenter Architecture
Code Camp 06   Model View Presenter ArchitectureCode Camp 06   Model View Presenter Architecture
Code Camp 06 Model View Presenter Architecturebitburner93
 
Design Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-BinderDesign Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-BinderSimon Massey
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobilenaral
 
Architectural Design Pattern: Android
Architectural Design Pattern: AndroidArchitectural Design Pattern: Android
Architectural Design Pattern: AndroidJitendra Kumar
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developersKai Koenig
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC StructureDipika Wadhvani
 
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Svetlin Nakov
 
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMAndrei Popa
 
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSJinkyu Kim
 
Model View Presenter For Android
Model View Presenter For AndroidModel View Presenter For Android
Model View Presenter For AndroidInnovationM
 
Model View Presenter For Android
Model View Presenter For AndroidModel View Presenter For Android
Model View Presenter For AndroidInnovationM
 
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fairTech_MX
 
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )Ahmed Emad
 
MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaYi-Shou Chen
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentVolodymyr Voytyshyn
 
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridOpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridDierk König
 

Similar to Class 02 Objective C (20)

Code Camp 06 Model View Presenter Architecture
Code Camp 06   Model View Presenter ArchitectureCode Camp 06   Model View Presenter Architecture
Code Camp 06 Model View Presenter Architecture
 
Design Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-BinderDesign Patterns in ZK: Java MVVM as Model-View-Binder
Design Patterns in ZK: Java MVVM as Model-View-Binder
 
MVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,MobileMVC(Model View Controller),Web,Enterprise,Mobile
MVC(Model View Controller),Web,Enterprise,Mobile
 
Architectural Design Pattern: Android
Architectural Design Pattern: AndroidArchitectural Design Pattern: Android
Architectural Design Pattern: Android
 
AngularJS for designers and developers
AngularJS for designers and developersAngularJS for designers and developers
AngularJS for designers and developers
 
MVC
MVCMVC
MVC
 
Ppt of Basic MVC Structure
Ppt of Basic MVC StructurePpt of Basic MVC Structure
Ppt of Basic MVC Structure
 
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
Architectural Patterns and Software Architectures: Client-Server, Multi-Tier,...
 
Models used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVMModels used in iOS programming, with a focus on MVVM
Models used in iOS programming, with a focus on MVVM
 
Mvvm
MvvmMvvm
Mvvm
 
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOSSoftware architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
Software architectural design patterns(MVC, MVP, MVVM, VIPER) for iOS
 
Model View Presenter For Android
Model View Presenter For AndroidModel View Presenter For Android
Model View Presenter For Android
 
Model View Presenter For Android
Model View Presenter For AndroidModel View Presenter For Android
Model View Presenter For Android
 
Mvc pattern and implementation in java fair
Mvc   pattern   and implementation   in   java fairMvc   pattern   and implementation   in   java fair
Mvc pattern and implementation in java fair
 
MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )MVVM ( Model View ViewModel )
MVVM ( Model View ViewModel )
 
MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoa
 
ASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web developmentASP.NET MVC as the next step in web development
ASP.NET MVC as the next step in web development
 
MVC.pptx
MVC.pptxMVC.pptx
MVC.pptx
 
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, MadridOpenDolphin with GroovyFX Workshop at GreachConf, Madrid
OpenDolphin with GroovyFX Workshop at GreachConf, Madrid
 
Mvc architecture
Mvc architectureMvc architecture
Mvc architecture
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Class 02 Objective C

  • 1. Class 2 – Introduction to Objective C • MVC – Model View Controller is an architectural pattern that splits interactions between users and applications into three roles: Controller (User input) View Model (User interface) (business logic) • Model - What your application is (but not how it is displayed). • Controller - How your Model is presented to the user (UI). • View – Your Controller’s minions.
  • 2. MVC - Model View Controller Controller (User input) View Model (User interface) (business logic) It’s all about managing communication between camps.
  • 3. MVC - Model View Controller Controller (User input) View Model (User interface) (business logic) Controllers can always talk directly to their Model Controllers can also talk directly to their View The Model and View should never speak to each other.
  • 4. MVC - Model View Controller Controller ? (User input) View Model (User interface) (business logic) Can View speak to its Controller? Sort of. Communications is “BLIND” and structured.
  • 5. MVC - Model View Controller target Controller (User input) action View Model (User interface) (business logic) The Controller can drop a target on itself. Then hand out, an action to the View.
  • 6. MVC - Model View Controller target Controller (User input) action View Model (User interface) (business logic) will should did Sometimes the View needs to synchronize with the Controller.
  • 7. MVC - Model View Controller did will target Controller should (User input) action View Model (User interface) (business logic) The Controller sets itself as the View’s delegate. The delegate is set via a protocol (i.e. it’s “blind” to class). Views don’t own the data they display. So, if needed, they have a protocol to acquire it.
  • 8. MVC - Model View Controller did target will count Controller should data at (User input) action View Model (User interface) (business logic) Controllers are almost always that data source (not Model). Controllers interpret/format Model information for the View.
  • 9. MVC - Model View Controller did target will count Controller should data at (User input) ? action View Model (User interface) (business logic) Can the model talk directly to the Controller? No. The Model is (should be) IU independent.
  • 10. MVC - Model View Controller did target will count Controller should data at (User input) Notification & KVO action View Model (User interface) (business logic) So what if the Model has information to update or something?. It uses a “radio station” – like broadcast mechanism.
  • 11. MVC - Model View Controller did target will count Controller should data at (User input) Notification & KVO action View Model (User interface) (business logic) Controllers (or other Model) “tune in” to interesting stuff. A View might “tune in”, but probably not to a Model’s “station”. Now combine MVC groups to make complicated programs… :P
  • 12. Objective C • New language to learn – Stick superset of C – Adds syntax for classes, methods, etc. – A few things to “Think differently” about (e.g. properties, dynamic binding). • Most important concept to understand today: Properties. – Usually we don’t access instance variables directly in Objective-C. – Instead, we use “properties”. – A “property” is just the combination of a getter method and a setter method in a class. – The getter has the name of the property (e.g. “myValue”) – The setter’s name is “set” plus capitalized property name (e.g. “setMyValye”) (To make this look nice, we always use a lowercase letter as the first letter of property name.) We just call the setter to store the values we want and the getter to get it. Simple!! • This is just your fist glimpse of this language – We’ll go much more into the details next class. – Don’t get too freaked out by the syntax at this point ;)