SlideShare a Scribd company logo
1 of 10
Delegation
 Object Messaging
What is Delegation?
Delegation is a design pattern in object-oriented
programming where an object, instead of
performing one of its stated tasks, delegates that
task to an associated helper object. It passes the
buck, so to speak (technically, an Inversion of
Responsibility).
The helper object is called the delegate. (source:
Wikepedia)
Examples: AppDelegate
• UIApplicationDelegate
 - (BOOL)application:(UIApplication
     *)application
     didFinishLaunchingWithOptions:
     (NSDictionary *)launchOptions
 -   (void)applicationWillTerminate:
     (UIApplication *)application
Examples: UITableView
• UITableViewDelegate
 - UITableViewCell *)tableView:
     (UITableView *)tableView
     cellForRowAtIndexPath:(NSIndexPath
     *)indexPath
 -   ...tableView:didDeselectRowAtIndexPath:
What Problem Does
 Delegation Solve?

  Object A   Object B
Write to File


          Object A                     Object B
        (Equipment)                 (User Interface)



                      somefile.txt
Define Pointers



            Object A                     Object B
          (Equipment)                 (User Interface)




ObjectB *myObject;
myObject = [self getSomeData:data];
App
                            Delegate
                                            Define Property




            Object A                          Object B
          (Equipment)                      (User Interface)




AppDelegate *d = [[UIApplication sharedApplication] delegate];
d.someString = ...
App
                      Delegate
                                  Define Delegate




          Object A                  Object B
        (Equipment)              (User Interface)


• Create Delegate Object • Helper App
• Defines Protocols       • Delegate of Object A
  - List of methods      • Implements Protocol
Demo


• Build a Program using Delegation

More Related Content

Viewers also liked (7)

Final delegation
Final delegationFinal delegation
Final delegation
 
Effective Delegation
Effective DelegationEffective Delegation
Effective Delegation
 
Effective Delegation
Effective DelegationEffective Delegation
Effective Delegation
 
authority relationships: delegation and decentralization
authority relationships: delegation and decentralizationauthority relationships: delegation and decentralization
authority relationships: delegation and decentralization
 
Effective delegation
Effective delegationEffective delegation
Effective delegation
 
Delegation - the art of managing
Delegation - the art of managingDelegation - the art of managing
Delegation - the art of managing
 
Communication in public administration
Communication in public administrationCommunication in public administration
Communication in public administration
 

Similar to Delegation Slides

Implementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS DevicesImplementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS Devices
Douglass Turner
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
Ahsanul Karim
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
Ahsanul Karim
 

Similar to Delegation Slides (20)

Debot android debugging library
Debot android debugging libraryDebot android debugging library
Debot android debugging library
 
Distributing information on iOS
Distributing information on iOSDistributing information on iOS
Distributing information on iOS
 
Ios development 2
Ios development 2Ios development 2
Ios development 2
 
Azure functions
Azure functionsAzure functions
Azure functions
 
KOIN for dependency Injection
KOIN for dependency InjectionKOIN for dependency Injection
KOIN for dependency Injection
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
 
Implementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS DevicesImplementing Data Visualization Apps on iOS Devices
Implementing Data Visualization Apps on iOS Devices
 
New to native? Getting Started With iOS Development
New to native?   Getting Started With iOS DevelopmentNew to native?   Getting Started With iOS Development
New to native? Getting Started With iOS Development
 
Mobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’sMobile Application Development with JUCE and Native API’s
Mobile Application Development with JUCE and Native API’s
 
iOS Beginners Lesson 2
iOS Beginners Lesson 2iOS Beginners Lesson 2
iOS Beginners Lesson 2
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
Converting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile CloudConverting Your Mobile App to the Mobile Cloud
Converting Your Mobile App to the Mobile Cloud
 
Android architecture
Android architecture Android architecture
Android architecture
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
Day 3: Getting Active Through Activities
Day 3: Getting Active Through ActivitiesDay 3: Getting Active Through Activities
Day 3: Getting Active Through Activities
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 +  = ❤️ (Firebase for Apple Developers) at Swift Leeds
 
iOS
iOSiOS
iOS
 
Mobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve MobileMobile Developers Talks: Delve Mobile
Mobile Developers Talks: Delve Mobile
 

Recently uploaded

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Recently uploaded (20)

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...
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 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 🐘
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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...
 

Delegation Slides

  • 2. What is Delegation? Delegation is a design pattern in object-oriented programming where an object, instead of performing one of its stated tasks, delegates that task to an associated helper object. It passes the buck, so to speak (technically, an Inversion of Responsibility). The helper object is called the delegate. (source: Wikepedia)
  • 3. Examples: AppDelegate • UIApplicationDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions: (NSDictionary *)launchOptions - (void)applicationWillTerminate: (UIApplication *)application
  • 4. Examples: UITableView • UITableViewDelegate - UITableViewCell *)tableView: (UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath - ...tableView:didDeselectRowAtIndexPath:
  • 5. What Problem Does Delegation Solve? Object A Object B
  • 6. Write to File Object A Object B (Equipment) (User Interface) somefile.txt
  • 7. Define Pointers Object A Object B (Equipment) (User Interface) ObjectB *myObject; myObject = [self getSomeData:data];
  • 8. App Delegate Define Property Object A Object B (Equipment) (User Interface) AppDelegate *d = [[UIApplication sharedApplication] delegate]; d.someString = ...
  • 9. App Delegate Define Delegate Object A Object B (Equipment) (User Interface) • Create Delegate Object • Helper App • Defines Protocols • Delegate of Object A - List of methods • Implements Protocol
  • 10. Demo • Build a Program using Delegation

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n