SlideShare uma empresa Scribd logo
1 de 47
Adopting Model-View-
 Controller in Cocoa
  and Objective-C
             Graham Lee
     http://twitter.com/iamleeg
Memory Lane
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born

•   1988: NeXT licence ObjC from StepStone
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born

•   1988: NeXT licence ObjC from StepStone

•   1993: GCC runtime for ObjC on !NeXT OS
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born

•   1988: NeXT licence ObjC from StepStone

•   1993: GCC runtime for ObjC on !NeXT OS

•   1995: NeXT purchase all ObjC rights
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born

•   1988: NeXT licence ObjC from StepStone

•   1993: GCC runtime for ObjC on !NeXT OS

•   1995: NeXT purchase all ObjC rights

•   1996: Apple (Computer, back then) acquire NeXT
Memory Lane
•   1980s: Brad Cox at StepStone adds Smalltalk
    messaging to C. Some guy named Bjarne invents
    “C with Classes”.

•   1986: Cox authors Object Oriented Programming: an
    evolutionary approach, ObjC is born

•   1988: NeXT licence ObjC from StepStone

•   1993: GCC runtime for ObjC on !NeXT OS

•   1995: NeXT purchase all ObjC rights

•   1996: Apple (Computer, back then) acquire NeXT

•   2001: Mac OS X released
What does MVC mean?
What does MVC mean?
          Display information




          Prepare content




                  Provide information
What does MVC mean?
   Respond to events      Display information




  Trigger service logic   Prepare content




 Do the work                      Provide information
Demo - one-minute
    browser
What did I do?
What did I do?
• Drew boxes in Interface Builder
What did I do?
• Drew boxes in Interface Builder
• Automatically created and archived View
  objects
What did I do?
• Drew boxes in Interface Builder
• Automatically created and archived View
  objects
• Automatically un-archived and displayed by
  my app
What did I do?
• Drew boxes in Interface Builder
• Automatically created and archived View
  objects
• Automatically un-archived and displayed by
  my app
• MVC score: F    Should really try harder
On syntax
On syntax

• [anObject   sendMessage: parameter];
On syntax

• [anObject sendMessage: parameter];
• @property int count;
• int x = anObject.count;
• anObject.count = x * 2;
Demo - model the URL
MVC Score: D Principles not really applied
Delegates
Delegates
• Customise an object’s behaviour by making
  decisions on its behalf
Delegates
• Customise an object’s behaviour by making
  decisions on its behalf
• GoF: Template Method (kindof)
Delegates
• Customise an object’s behaviour by making
  decisions on its behalf
• GoF: Template Method (kindof)
• Implement a subset of delegate methods,
  runtime introspection avoids exceptions
Delegates
• Customise an object’s behaviour by making
  decisions on its behalf
• GoF: Template Method (kindof)
• Implement a subset of delegate methods,
  runtime introspection avoids exceptions
• We’ll use WebFrameLoadDelegate
Demo - fix the address
        bar
Demo - fix the address
        bar
     (oh, and add window titles)
Cocoa Bindings
Cocoa Bindings


  «bind»
Cocoa Bindings


  «bind»   «observe»
MVC Score: B Good, but I want bookmarks ☺
Demo - bookmarks
MVC Score: A That’ll do for now!
?

Mais conteúdo relacionado

Mais de Graham Lee

Beyond build and analyze
Beyond build and analyzeBeyond build and analyze
Beyond build and analyzeGraham Lee
 
Sign your code
Sign your codeSign your code
Sign your codeGraham Lee
 
Unit testing for Cocoa developers
Unit testing for Cocoa developersUnit testing for Cocoa developers
Unit testing for Cocoa developersGraham Lee
 
Security and Encryption on iOS
Security and Encryption on iOSSecurity and Encryption on iOS
Security and Encryption on iOSGraham Lee
 
Dial M For Mitigation
Dial M For MitigationDial M For Mitigation
Dial M For MitigationGraham Lee
 
Presentations and Podcasts - OxMug July 2009
Presentations and Podcasts - OxMug July 2009Presentations and Podcasts - OxMug July 2009
Presentations and Podcasts - OxMug July 2009Graham Lee
 
Intel Briefing Notes
Intel Briefing NotesIntel Briefing Notes
Intel Briefing NotesGraham Lee
 
Designing a Secure Cocoa App
Designing a Secure Cocoa AppDesigning a Secure Cocoa App
Designing a Secure Cocoa AppGraham Lee
 

Mais de Graham Lee (8)

Beyond build and analyze
Beyond build and analyzeBeyond build and analyze
Beyond build and analyze
 
Sign your code
Sign your codeSign your code
Sign your code
 
Unit testing for Cocoa developers
Unit testing for Cocoa developersUnit testing for Cocoa developers
Unit testing for Cocoa developers
 
Security and Encryption on iOS
Security and Encryption on iOSSecurity and Encryption on iOS
Security and Encryption on iOS
 
Dial M For Mitigation
Dial M For MitigationDial M For Mitigation
Dial M For Mitigation
 
Presentations and Podcasts - OxMug July 2009
Presentations and Podcasts - OxMug July 2009Presentations and Podcasts - OxMug July 2009
Presentations and Podcasts - OxMug July 2009
 
Intel Briefing Notes
Intel Briefing NotesIntel Briefing Notes
Intel Briefing Notes
 
Designing a Secure Cocoa App
Designing a Secure Cocoa AppDesigning a Secure Cocoa App
Designing a Secure Cocoa App
 

Último

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 

Último (20)

Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 

Adopting MVC in Cocoa

  • 1. Adopting Model-View- Controller in Cocoa and Objective-C Graham Lee http://twitter.com/iamleeg
  • 3. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”.
  • 4. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born
  • 5. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born • 1988: NeXT licence ObjC from StepStone
  • 6. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born • 1988: NeXT licence ObjC from StepStone • 1993: GCC runtime for ObjC on !NeXT OS
  • 7. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born • 1988: NeXT licence ObjC from StepStone • 1993: GCC runtime for ObjC on !NeXT OS • 1995: NeXT purchase all ObjC rights
  • 8. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born • 1988: NeXT licence ObjC from StepStone • 1993: GCC runtime for ObjC on !NeXT OS • 1995: NeXT purchase all ObjC rights • 1996: Apple (Computer, back then) acquire NeXT
  • 9. Memory Lane • 1980s: Brad Cox at StepStone adds Smalltalk messaging to C. Some guy named Bjarne invents “C with Classes”. • 1986: Cox authors Object Oriented Programming: an evolutionary approach, ObjC is born • 1988: NeXT licence ObjC from StepStone • 1993: GCC runtime for ObjC on !NeXT OS • 1995: NeXT purchase all ObjC rights • 1996: Apple (Computer, back then) acquire NeXT • 2001: Mac OS X released
  • 10. What does MVC mean?
  • 11. What does MVC mean? Display information Prepare content Provide information
  • 12. What does MVC mean? Respond to events Display information Trigger service logic Prepare content Do the work Provide information
  • 13. Demo - one-minute browser
  • 14. What did I do?
  • 15. What did I do? • Drew boxes in Interface Builder
  • 16. What did I do? • Drew boxes in Interface Builder • Automatically created and archived View objects
  • 17. What did I do? • Drew boxes in Interface Builder • Automatically created and archived View objects • Automatically un-archived and displayed by my app
  • 18. What did I do? • Drew boxes in Interface Builder • Automatically created and archived View objects • Automatically un-archived and displayed by my app • MVC score: F Should really try harder
  • 20. On syntax • [anObject sendMessage: parameter];
  • 21. On syntax • [anObject sendMessage: parameter]; • @property int count; • int x = anObject.count; • anObject.count = x * 2;
  • 22. Demo - model the URL
  • 23.
  • 24.
  • 25. MVC Score: D Principles not really applied
  • 27. Delegates • Customise an object’s behaviour by making decisions on its behalf
  • 28. Delegates • Customise an object’s behaviour by making decisions on its behalf • GoF: Template Method (kindof)
  • 29. Delegates • Customise an object’s behaviour by making decisions on its behalf • GoF: Template Method (kindof) • Implement a subset of delegate methods, runtime introspection avoids exceptions
  • 30. Delegates • Customise an object’s behaviour by making decisions on its behalf • GoF: Template Method (kindof) • Implement a subset of delegate methods, runtime introspection avoids exceptions • We’ll use WebFrameLoadDelegate
  • 31. Demo - fix the address bar
  • 32. Demo - fix the address bar (oh, and add window titles)
  • 34. Cocoa Bindings «bind»
  • 35. Cocoa Bindings «bind» «observe»
  • 36.
  • 37.
  • 38.
  • 39. MVC Score: B Good, but I want bookmarks ☺
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46. MVC Score: A That’ll do for now!
  • 47. ?

Notas do Editor

  1. Who I am. What _are_ Objective-C and Cocoa? First, a walk down memory lane.
  2. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  3. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  4. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  5. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  6. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  7. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  8. Objective-C was really popularised by NeXT on their NeXTSTEP OS. Note that there’s never been a language standard, but Apple owns all trademarks and drives the language definition. GCC support on other platforms plays catch-up. Next: what exactly is MVC?
  9. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  10. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  11. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  12. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  13. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  14. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  15. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  16. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  17. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  18. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  19. Well, we know it’s Model-View-Controller, I put that on the first slide. But what does each level do? Next: into the sample.
  20. I could do 45 of these in one session - it’s a shame there’s no market.
  21. So we can see how Interface Builder works, but haven’t designed an MVC app at all. FAIL. Next: see what does really count as a model.
  22. So we can see how Interface Builder works, but haven’t designed an MVC app at all. FAIL. Next: see what does really count as a model.
  23. So we can see how Interface Builder works, but haven’t designed an MVC app at all. FAIL. Next: see what does really count as a model.
  24. So we can see how Interface Builder works, but haven’t designed an MVC app at all. FAIL. Next: see what does really count as a model.
  25. So we can see how Interface Builder works, but haven’t designed an MVC app at all. FAIL. Next: see what does really count as a model.
  26. Brief description of the message-sending syntax and Objective-C 2.0 properties. Just enough so that the code samples make sense.
  27. Brief description of the message-sending syntax and Objective-C 2.0 properties. Just enough so that the code samples make sense.
  28. Brief description of the message-sending syntax and Objective-C 2.0 properties. Just enough so that the code samples make sense.
  29. Brief description of the message-sending syntax and Objective-C 2.0 properties. Just enough so that the code samples make sense.
  30. The only model object we really have is the URL. Let’s see how we can factor that out into an MVC design. Next: class view.
  31. So, we’ve separated things out, but that model object isn’t really used. The Controller is just filling it in out of a sense of duty. Next: move onto fixing the URL field, but discuss delegates first.
  32. So, we’ve separated things out, but that model object isn’t really used. The Controller is just filling it in out of a sense of duty. Next: move onto fixing the URL field, but discuss delegates first.
  33. So, we’ve separated things out, but that model object isn’t really used. The Controller is just filling it in out of a sense of duty. Next: move onto fixing the URL field, but discuss delegates first.
  34. So, we’ve separated things out, but that model object isn’t really used. The Controller is just filling it in out of a sense of duty. Next: move onto fixing the URL field, but discuss delegates first.
  35. So, we’ve separated things out, but that model object isn’t really used. The Controller is just filling it in out of a sense of duty. Next: move onto fixing the URL field, but discuss delegates first.
  36. Some objects implement a basic behaviour then allow another object to interpose at specific points in the process. This is called delegation in Cocoa. It’s a bit like a Template Method, except that the delegate doesn’t encapsulate the original object. ObjC messaging means you can implement a subset of the delegate methods.
  37. Some objects implement a basic behaviour then allow another object to interpose at specific points in the process. This is called delegation in Cocoa. It’s a bit like a Template Method, except that the delegate doesn’t encapsulate the original object. ObjC messaging means you can implement a subset of the delegate methods.
  38. Some objects implement a basic behaviour then allow another object to interpose at specific points in the process. This is called delegation in Cocoa. It’s a bit like a Template Method, except that the delegate doesn’t encapsulate the original object. ObjC messaging means you can implement a subset of the delegate methods.
  39. Some objects implement a basic behaviour then allow another object to interpose at specific points in the process. This is called delegation in Cocoa. It’s a bit like a Template Method, except that the delegate doesn’t encapsulate the original object. ObjC messaging means you can implement a subset of the delegate methods.
  40. We can use a delegation point in the loading of a web page in order to get the address that the web view has really gone to. Oh, where’s the code to update the text field, though?
  41. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  42. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  43. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  44. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  45. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  46. If a view (say) binds to a model, then the model is actually replaced by a proxy which posts observer notifications whenever changes are requested. Next: how that works in the browser app.
  47. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  48. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  49. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  50. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  51. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  52. So apart from triggering the “go” operation, the text field and web view are entirely decoupled. The model now has some utility. Next: bookmarks.
  53. Add the bookmarks. No need to change the model, just bind the new UI to a collection of web addresses.
  54. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  55. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  56. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  57. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  58. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  59. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  60. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  61. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!
  62. First: NSArrayController manages its content Second: Add bookmark, note how information only passed over the controller layer Third: Bookmark this page, again information flow over controller layer only Next: Qs!