SlideShare a Scribd company logo
1 of 37
Download to read offline
LEARNING IOS
and hunting NSZombies in 3 weeks
About Me
                  @calvinchengx

• Chemical engineering from NUS
• Scientific Freezer Engineer for a local company
• Started my own software company, small team of 5 + some
interns
• Learned programming and web development along the way
• (web) appify scientific projects with universities
• Various consumer web apps python/django
• Attempted my own product start-up(s) including an app with
PhoneGap
• Currently working on an academic conference web app as a
product start-up, serving 3-4 conferences so far
3 weeks? Why so kan-cheong??

             :-)
“Teach yourself programming in Ten
       Years (10,000 hours)
         Peter Norvig, wrote in 2001
        http://norvig.com/21-days.html
“A little learning is a dangerous thing.
          Alexander Pope (1688 - 1744)
“Twas well observed by Lord Bacon, That a little
 knowledge is apt to puff up, and make men giddy,
but a great share of it will set them right, and bring
 them to low and humble thoughts of themselves.

             Anonymous, A B (16th century)
“Ars longa, vita brevis,
    occasio praeceps,
experimentum periculosm,
     iudicium difficile
     Hippocrates (c. 400 BC)
“To realize that you do not
 understand is virtue; Not to realize
that you do not understand is defect.
        Lao Tzu (c. 604 BC, Zhou Dynasty)
OK, OK, I GET IT!!! :-)
    So are you, Mr Calvin Cheng,
going to change the title of this talk???
NOT QUITE :-)
Evolutionary superiority triumphs Technical superiority

             Adopt a “Growth Mindset”
FIXED
You are great, or you aren’t


GROWTH
Anyone can master anything
Learning iOS and hunting NSZombies in 3 weeks
Learning iOS and hunting NSZombies in 3 weeks
Learning iOS and hunting NSZombies in 3 weeks
WHY THIS MATTERS?
•   Split 10,000 hours into very small projects/parts-of-a-big-project
•   Push your boundary for each project and learn
•   Learning != Muscle Memory
•   Practice
Peter Norvig
                           tl;dr
•   Get interested
•   Program
•   Talk with other programmers
•   Work with other programmers
•   Work after other programmers
•   Learn at least 6 languages
•   Figure out computer instruction execution, disk, memory
•   Learn language standardization
•   Get out from language standardization
Getting started with iOS/Objective-C

• Read blog posts and books; download and play with iOS apps
• Program with Tutorials; and your own creations
• Talk with people on http://facebook.com/groups/iosdevscout
• Work with colleagues or hack-alongs @ iOS Dev Scout meet-ups
• Work after iOS open source libraries on http://github.com
• Learn at least Python, Javascript (jQuery), golang, C, clojure (etc)
• Understand pointers/memory management, multi-threading etc
• Read best practices, learn programming methodologies, XP,
TDD, CI, CD and practice UI/UX.

• Repeat
Key Concepts in Objective-C & iOS


• Superset of C
• Message passing (small talk/obj-c) versus Method calls (c/c++)
• Delegation versus Inheritance
Message Passing
      vs
Method Calling
• The difference between message passing and calling a
method is in the linking.

• c and c++ the function calls are linked at compile time
with the linker (except with virtual functions which
requires some runtime support).

• objective-c and smalltalk, you cannot guarantee what
functions will be run until runtime. The runtime
determines if an object actually implements the function
represented in the message. If it doesn't implement it, the
class will usually either forward the message onto another
object, or throw an exception.
• Overall, a message is the same thing as calling a
method directly, except the runtime finds the exact
function to be called instead of it being linked at compile
time.
Delegation


The real reason that you'd want to use delegation is that
the class you were designing has some resemblance to
another class, but isn't really enough like it that you'd call it
the same kind of thing.
Delegation


In c++, the only delegation that make sense is when you
are is a service (words ending with 'er', 'or', 'tory',
example HTMLLexER, JSONParsER, PrettyPrintER).

That is exactly what delegation sounds like. Delegating a
task to an expert class. (This could also result because the
lack of support for traits)

- Don Han
Delegation: An Example


Built-in iOS         Your Custom
  Object                Object




                    Be a Delegate!
                       (dance)
Delegation: An Example
@protocol CLLocationManagerDelegate<NSObject>                          Built-in iOS
@optional

/*
   * locationManager:didUpdateToLocation:fromLocation:
   *
   * Discussion:
   * Invoked when a new location is available. oldLocation may be nil if there is no previous location
   * available.
   */
- (void)locationManager:(CLLocationManager *)manager
	

 didUpdateToLocation:(CLLocation *)newLocation
	

 fromLocation:(CLLocation *)oldLocation;

...

@end
Delegation: An Example
                                                                  Our Custom
                                                                   class/object
// CurrentLocationViewController.h
// implements CLLocationManagerDelegate protocol
                                                                 (be a delegate!)
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>

@interface CurrentLocationViewController : UIViewController <CLLocationManagerDelegate>

....

@end
Delegation: An Example
#import "CurrentLocationViewController.h"
                                                                  Our Custom
                                                                   class/object
@interface CurrentLocationViewController ()
- (void)updateLabels;                                            (be a delegate!)
- (void)startLocationManager;
- (void)stopLocationManager;
- (void)configureGetButton;
- (NSString *)stringFromPlacemark:(CLPlacemark *)thePlacemark;
@end

@implementation CurrentLocationViewController {
 CLGeocoder *geocoder;
 CLPlacemark *placemark;
 BOOL performingReverseGeocoding;
 NSError *lastGeocodingError;

    CLLocationManager *locationManager;
    CLLocation *location;
    NSError *lastLocationError;
    BOOL updatingLocation;
}
Delegation: An Example
                                                                        Our Custom
                                                                         class/object
                                                                       (be a delegate!)
...

- (void)startLocationManager
{
   if ([CLLocationManager locationServicesEnabled]) {
       locationManager.delegate = self;
       locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
       [locationManager startUpdatingLocation];
       updatingLocation = YES;

          [self performSelector:@selector(didTimeOut:) withObject:nil afterDelay:60];
      }
}

...
Delegation: An Example
                                                                Our Custom
                                                                 class/object
                                                               (be a delegate!)
...
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:
(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation

{
      NSLog(@"didUpdateToLocation %@", newLocation);

      if ([newLocation.timestamp timeIntervalSinceNow] < -5.0) {
          return;
      }

      if (newLocation.horizontalAccuracy < 0) {
          return;

      }                               In CLLocationManagerDelegate.h
      // This is new
      CLLocationDistance distance = MAXFLOAT;
      if (location != nil) {
          distance = [newLocation distanceFromLocation:location];
      }

...
Delegation: An Example
                                                                    Built-in iOS
@protocol CLLocationManagerDelegate<NSObject>

@optional

/*
   * locationManager:didUpdateToLocation:fromLocation:
   *
   * Discussion:
   * Invoked when a new location is available. oldLocation may be nil if there is no
previous location
   * available.
   */
- (void)locationManager:(CLLocationManager *)manager
	

 didUpdateToLocation:(CLLocation *)newLocation
	

 fromLocation:(CLLocation *)oldLocation;
Takeaway:

Not much use cases for subclass-ing.

        Think in terms of
   composition & delegation to
  “specialized” pre-written code
Resources: iOS
• iOS Dev Scout
• iTunes University (Stanford, Paul Hegarty)
• Ray Wenderlich (Tutorials, Free & Paid)
•   https://github.com/calvinchengx/BullsEye
•   https://github.com/calvinchengx/Checklists
•   https://github.com/calvinchengx/Calculator
•   https://github.com/calvinchengx/MyLocations3
•   https://bitbucket.org/calvinchengx/foloup2
People I learn with/from




          many folks from......
Learning iOS and hunting NSZombies in 3 weeks
Learning iOS and hunting NSZombies in 3 weeks
Expand your programming perspectives. JOIN:

• iOS Dev Scout https://www.facebook.com/groups/iosdevscout/
• Pythonistas https://www.facebook.com/groups/pythonsg/
• PHP https://www.facebook.com/groups/sghypertextpreprocessors/
• Agile & DevOps https://www.facebook.com/groups/agiledevopssg/
• LittleHackers.com https://www.facebook.com/groups/littlehackers/
• golang SG https://www.facebook.com/groups/golanggonuts/
• RaspberryPi SG https://www.facebook.com/groups/
raspberrypisingapore/
Learning iOS and hunting NSZombies in 3 weeks

More Related Content

What's hot

MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4James Johnson
 
PresentationPatterns_v2
PresentationPatterns_v2PresentationPatterns_v2
PresentationPatterns_v2Maksym Tolstik
 
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBoxKobkrit Viriyayudhakorn
 
OOP, API Design and MVP
OOP, API Design and MVPOOP, API Design and MVP
OOP, API Design and MVPHarshith Keni
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptKobkrit Viriyayudhakorn
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CDataArt
 
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Julie Meloni
 
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensions
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor ExtensionsConnect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensions
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensionsstable|kernel
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScriptLilia Sfaxi
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQueryGill Cleeren
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationWebStackAcademy
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate pptAneega
 
iOS viper presentation
iOS viper presentationiOS viper presentation
iOS viper presentationRajat Datta
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with JavascriptAkshay Mathur
 

What's hot (20)

MVC and Entity Framework 4
MVC and Entity Framework 4MVC and Entity Framework 4
MVC and Entity Framework 4
 
PresentationPatterns_v2
PresentationPatterns_v2PresentationPatterns_v2
PresentationPatterns_v2
 
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
[React Native] Lecture 4: Basic Elements and UI Layout by using FlexBox
 
OOP, API Design and MVP
OOP, API Design and MVPOOP, API Design and MVP
OOP, API Design and MVP
 
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScriptReact Native Introduction: Making Real iOS and Android Mobile App By JavaScript
React Native Introduction: Making Real iOS and Android Mobile App By JavaScript
 
Никита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-CНикита Корчагин - Programming Apple iOS with Objective-C
Никита Корчагин - Programming Apple iOS with Objective-C
 
iOS (7) Workshop
iOS (7) WorkshopiOS (7) Workshop
iOS (7) Workshop
 
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...Speaking 'Development Language' (Or, how to get your hands dirty with technic...
Speaking 'Development Language' (Or, how to get your hands dirty with technic...
 
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensions
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor ExtensionsConnect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensions
Connect.Tech- Enhancing Your Workflow With Xcode Source Editor Extensions
 
Client-side JavaScript
Client-side JavaScriptClient-side JavaScript
Client-side JavaScript
 
Getting started with jQuery
Getting started with jQueryGetting started with jQuery
Getting started with jQuery
 
Solid OOPS
Solid OOPSSolid OOPS
Solid OOPS
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and AuthorizationAngular - Chapter 9 - Authentication and Authorization
Angular - Chapter 9 - Authentication and Authorization
 
MVS: An angular MVC
MVS: An angular MVCMVS: An angular MVC
MVS: An angular MVC
 
Hibernate ppt
Hibernate pptHibernate ppt
Hibernate ppt
 
iOS viper presentation
iOS viper presentationiOS viper presentation
iOS viper presentation
 
React-Native Lecture 11: In App Storage
React-Native Lecture 11: In App StorageReact-Native Lecture 11: In App Storage
React-Native Lecture 11: In App Storage
 
Getting Started with Javascript
Getting Started with JavascriptGetting Started with Javascript
Getting Started with Javascript
 
Java Beans
Java BeansJava Beans
Java Beans
 

Similar to Learning iOS and hunting NSZombies in 3 weeks

How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsRan Mizrahi
 
Aplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackAplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackNelson Glauber Leal
 
Javascript internals
Javascript internalsJavascript internals
Javascript internalsNir Noy
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing UpDavid Padbury
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring ClojurescriptLuke Donnet
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile applicationFabrizio Giudici
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksMongoDB
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not JavaChris Adamson
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOSPetr Dvorak
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackNelson Glauber Leal
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developerscacois
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackNelson Glauber Leal
 
Cloud Orchestration with RightScale Cloud Workflow
Cloud Orchestration with RightScale Cloud WorkflowCloud Orchestration with RightScale Cloud Workflow
Cloud Orchestration with RightScale Cloud WorkflowRightScale
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016Kacper Gunia
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Shekhar Gulati
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeJesse Gallagher
 

Similar to Learning iOS and hunting NSZombies in 3 weeks (20)

How AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design PatternsHow AngularJS Embraced Traditional Design Patterns
How AngularJS Embraced Traditional Design Patterns
 
Twins: OOP and FP
Twins: OOP and FPTwins: OOP and FP
Twins: OOP and FP
 
Aplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & JetpackAplicações assíncronas no Android com Coroutines & Jetpack
Aplicações assíncronas no Android com Coroutines & Jetpack
 
Javascript internals
Javascript internalsJavascript internals
Javascript internals
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Exploring Clojurescript
Exploring ClojurescriptExploring Clojurescript
Exploring Clojurescript
 
Designing a JavaFX Mobile application
Designing a JavaFX Mobile applicationDesigning a JavaFX Mobile application
Designing a JavaFX Mobile application
 
Fun Teaching MongoDB New Tricks
Fun Teaching MongoDB New TricksFun Teaching MongoDB New Tricks
Fun Teaching MongoDB New Tricks
 
Objective-C Is Not Java
Objective-C Is Not JavaObjective-C Is Not Java
Objective-C Is Not Java
 
MFF UK - Introduction to iOS
MFF UK - Introduction to iOSMFF UK - Introduction to iOS
MFF UK - Introduction to iOS
 
The IoC Hydra
The IoC HydraThe IoC Hydra
The IoC Hydra
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
Node.js Patterns for Discerning Developers
Node.js Patterns for Discerning DevelopersNode.js Patterns for Discerning Developers
Node.js Patterns for Discerning Developers
 
Aplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & JetpackAplicações assíncronas no Android com
Coroutines & Jetpack
Aplicações assíncronas no Android com
Coroutines & Jetpack
 
COScheduler
COSchedulerCOScheduler
COScheduler
 
Cloud Orchestration with RightScale Cloud Workflow
Cloud Orchestration with RightScale Cloud WorkflowCloud Orchestration with RightScale Cloud Workflow
Cloud Orchestration with RightScale Cloud Workflow
 
Week3
Week3Week3
Week3
 
The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016The IoC Hydra - Dutch PHP Conference 2016
The IoC Hydra - Dutch PHP Conference 2016
 
Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud Java(ee) mongo db applications in the cloud
Java(ee) mongo db applications in the cloud
 
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in PracticeOpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
OpenNTF Webinar 2022-08 - XPages Jakarta EE Support in Practice
 

More from Calvin Cheng

FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinFOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinCalvin Cheng
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Calvin Cheng
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Calvin Cheng
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4Calvin Cheng
 
So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?Calvin Cheng
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjangoCalvin Cheng
 
Saving Gaia with GeoDjango
Saving Gaia with GeoDjangoSaving Gaia with GeoDjango
Saving Gaia with GeoDjangoCalvin Cheng
 
Agile Apps with App Engine
Agile Apps with App EngineAgile Apps with App Engine
Agile Apps with App EngineCalvin Cheng
 

More from Calvin Cheng (12)

FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/SovrinFOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
FOSSASIA 2018 Self-Sovereign Identity with Hyperledger Indy/Sovrin
 
Hashgraph as Code
Hashgraph as CodeHashgraph as Code
Hashgraph as Code
 
Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)Functional Programming for OO Programmers (part 2)
Functional Programming for OO Programmers (part 2)
 
Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)Functional Programming for OO Programmers (part 1)
Functional Programming for OO Programmers (part 1)
 
iOS Beginners Lesson 4
iOS Beginners Lesson 4iOS Beginners Lesson 4
iOS Beginners Lesson 4
 
So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?So, you want to build a Bluetooth Low Energy device?
So, you want to build a Bluetooth Low Energy device?
 
Fabric
FabricFabric
Fabric
 
Ladypy 01
Ladypy 01Ladypy 01
Ladypy 01
 
zhng your vim
zhng your vimzhng your vim
zhng your vim
 
Django101 geodjango
Django101 geodjangoDjango101 geodjango
Django101 geodjango
 
Saving Gaia with GeoDjango
Saving Gaia with GeoDjangoSaving Gaia with GeoDjango
Saving Gaia with GeoDjango
 
Agile Apps with App Engine
Agile Apps with App EngineAgile Apps with App Engine
Agile Apps with App Engine
 

Recently uploaded

UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Commit University
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxUdaiappa Ramachandran
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8DianaGray10
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesDavid Newbury
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 

Recently uploaded (20)

UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)Crea il tuo assistente AI con lo Stregatto (open source python framework)
Crea il tuo assistente AI con lo Stregatto (open source python framework)
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
Building AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptxBuilding AI-Driven Apps Using Semantic Kernel.pptx
Building AI-Driven Apps Using Semantic Kernel.pptx
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8UiPath Studio Web workshop series - Day 8
UiPath Studio Web workshop series - Day 8
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
201610817 - edge part1
201610817 - edge part1201610817 - edge part1
201610817 - edge part1
 
Linked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond OntologiesLinked Data in Production: Moving Beyond Ontologies
Linked Data in Production: Moving Beyond Ontologies
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
20150722 - AGV
20150722 - AGV20150722 - AGV
20150722 - AGV
 

Learning iOS and hunting NSZombies in 3 weeks

  • 1. LEARNING IOS and hunting NSZombies in 3 weeks
  • 2. About Me @calvinchengx • Chemical engineering from NUS • Scientific Freezer Engineer for a local company • Started my own software company, small team of 5 + some interns • Learned programming and web development along the way • (web) appify scientific projects with universities • Various consumer web apps python/django • Attempted my own product start-up(s) including an app with PhoneGap • Currently working on an academic conference web app as a product start-up, serving 3-4 conferences so far
  • 3. 3 weeks? Why so kan-cheong?? :-)
  • 4. “Teach yourself programming in Ten Years (10,000 hours) Peter Norvig, wrote in 2001 http://norvig.com/21-days.html
  • 5. “A little learning is a dangerous thing. Alexander Pope (1688 - 1744)
  • 6. “Twas well observed by Lord Bacon, That a little knowledge is apt to puff up, and make men giddy, but a great share of it will set them right, and bring them to low and humble thoughts of themselves. Anonymous, A B (16th century)
  • 7. “Ars longa, vita brevis, occasio praeceps, experimentum periculosm, iudicium difficile Hippocrates (c. 400 BC)
  • 8. “To realize that you do not understand is virtue; Not to realize that you do not understand is defect. Lao Tzu (c. 604 BC, Zhou Dynasty)
  • 9. OK, OK, I GET IT!!! :-) So are you, Mr Calvin Cheng, going to change the title of this talk???
  • 10. NOT QUITE :-) Evolutionary superiority triumphs Technical superiority Adopt a “Growth Mindset”
  • 11. FIXED You are great, or you aren’t GROWTH Anyone can master anything
  • 15. WHY THIS MATTERS? • Split 10,000 hours into very small projects/parts-of-a-big-project • Push your boundary for each project and learn • Learning != Muscle Memory • Practice
  • 16. Peter Norvig tl;dr • Get interested • Program • Talk with other programmers • Work with other programmers • Work after other programmers • Learn at least 6 languages • Figure out computer instruction execution, disk, memory • Learn language standardization • Get out from language standardization
  • 17. Getting started with iOS/Objective-C • Read blog posts and books; download and play with iOS apps • Program with Tutorials; and your own creations • Talk with people on http://facebook.com/groups/iosdevscout • Work with colleagues or hack-alongs @ iOS Dev Scout meet-ups • Work after iOS open source libraries on http://github.com • Learn at least Python, Javascript (jQuery), golang, C, clojure (etc) • Understand pointers/memory management, multi-threading etc • Read best practices, learn programming methodologies, XP, TDD, CI, CD and practice UI/UX. • Repeat
  • 18. Key Concepts in Objective-C & iOS • Superset of C • Message passing (small talk/obj-c) versus Method calls (c/c++) • Delegation versus Inheritance
  • 19. Message Passing vs Method Calling
  • 20. • The difference between message passing and calling a method is in the linking. • c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). • objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn't implement it, the class will usually either forward the message onto another object, or throw an exception.
  • 21. • Overall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.
  • 22. Delegation The real reason that you'd want to use delegation is that the class you were designing has some resemblance to another class, but isn't really enough like it that you'd call it the same kind of thing.
  • 23. Delegation In c++, the only delegation that make sense is when you are is a service (words ending with 'er', 'or', 'tory', example HTMLLexER, JSONParsER, PrettyPrintER). That is exactly what delegation sounds like. Delegating a task to an expert class. (This could also result because the lack of support for traits) - Don Han
  • 24. Delegation: An Example Built-in iOS Your Custom Object Object Be a Delegate! (dance)
  • 25. Delegation: An Example @protocol CLLocationManagerDelegate<NSObject> Built-in iOS @optional /* * locationManager:didUpdateToLocation:fromLocation: * * Discussion: * Invoked when a new location is available. oldLocation may be nil if there is no previous location * available. */ - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation; ... @end
  • 26. Delegation: An Example Our Custom class/object // CurrentLocationViewController.h // implements CLLocationManagerDelegate protocol (be a delegate!) #import <UIKit/UIKit.h> #import <CoreLocation/CoreLocation.h> @interface CurrentLocationViewController : UIViewController <CLLocationManagerDelegate> .... @end
  • 27. Delegation: An Example #import "CurrentLocationViewController.h" Our Custom class/object @interface CurrentLocationViewController () - (void)updateLabels; (be a delegate!) - (void)startLocationManager; - (void)stopLocationManager; - (void)configureGetButton; - (NSString *)stringFromPlacemark:(CLPlacemark *)thePlacemark; @end @implementation CurrentLocationViewController { CLGeocoder *geocoder; CLPlacemark *placemark; BOOL performingReverseGeocoding; NSError *lastGeocodingError; CLLocationManager *locationManager; CLLocation *location; NSError *lastLocationError; BOOL updatingLocation; }
  • 28. Delegation: An Example Our Custom class/object (be a delegate!) ... - (void)startLocationManager { if ([CLLocationManager locationServicesEnabled]) { locationManager.delegate = self; locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters; [locationManager startUpdatingLocation]; updatingLocation = YES; [self performSelector:@selector(didTimeOut:) withObject:nil afterDelay:60]; } } ...
  • 29. Delegation: An Example Our Custom class/object (be a delegate!) ... - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSLog(@"didUpdateToLocation %@", newLocation); if ([newLocation.timestamp timeIntervalSinceNow] < -5.0) { return; } if (newLocation.horizontalAccuracy < 0) { return; } In CLLocationManagerDelegate.h // This is new CLLocationDistance distance = MAXFLOAT; if (location != nil) { distance = [newLocation distanceFromLocation:location]; } ...
  • 30. Delegation: An Example Built-in iOS @protocol CLLocationManagerDelegate<NSObject> @optional /* * locationManager:didUpdateToLocation:fromLocation: * * Discussion: * Invoked when a new location is available. oldLocation may be nil if there is no previous location * available. */ - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation;
  • 31. Takeaway: Not much use cases for subclass-ing. Think in terms of composition & delegation to “specialized” pre-written code
  • 32. Resources: iOS • iOS Dev Scout • iTunes University (Stanford, Paul Hegarty) • Ray Wenderlich (Tutorials, Free & Paid) • https://github.com/calvinchengx/BullsEye • https://github.com/calvinchengx/Checklists • https://github.com/calvinchengx/Calculator • https://github.com/calvinchengx/MyLocations3 • https://bitbucket.org/calvinchengx/foloup2
  • 33. People I learn with/from many folks from......
  • 36. Expand your programming perspectives. JOIN: • iOS Dev Scout https://www.facebook.com/groups/iosdevscout/ • Pythonistas https://www.facebook.com/groups/pythonsg/ • PHP https://www.facebook.com/groups/sghypertextpreprocessors/ • Agile & DevOps https://www.facebook.com/groups/agiledevopssg/ • LittleHackers.com https://www.facebook.com/groups/littlehackers/ • golang SG https://www.facebook.com/groups/golanggonuts/ • RaspberryPi SG https://www.facebook.com/groups/ raspberrypisingapore/

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. A small amount of knowledge can mislead people into thinking that they are more expert than they really are. The &amp;#x201C;learning version&amp;#x201D;.\n
  6. A B, predating Alexander Pope, the &amp;#x201C;Knowledge version&amp;#x201D;.\n
  7. Life is short, [the] craft long, opportunity fleeting, experiment treacherous, judgment difficult.\n
  8. \n
  9. \n
  10. \n
  11. \n
  12. Growth mindset\n
  13. Growth mindset\n
  14. \n
  15. In the video, Derek Sivers talk about a study where 2 classes are conducted in 2 different manners.\n\nMany small claypots (quantity-and-practice focused) versus Make 1 good claypot (quality-and-single-grade-approach).\n
  16. \n
  17. \n
  18. http://stackoverflow.com/questions/5451926/is-message-passing-in-small-talk-and-objectivec-same-as-calling-method-with-valuOnce the actual function call is made, there is no difference. The difference between message passing and calling a method is in the linking. For languages like c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). With languages that use a messaging system like objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn&apos;t implement it, the class will usually either forward the message onto another object, or throw an exception. However, if the class does implement it, the runtime determines the address of the actual function, and calls it in the exact same manner as c (pushing the arguments and the return address onto the stack).\nOverall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.\nhttp://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance\nWith delegates, you can have one object be the delegate of many other objects. For example, you can have your MyController instance be the delegate of an NSTableView, an NSTextField, an NSWindow, and any other objects that compose your interface. This gives a compact place to put all of your user interface code related to one section of your UI.\nIf you&apos;d done that with subclassing, you&apos;d have to create one subclass every object you wanted callbacks from.\nNot only does delegation in C++ and Java mean writing more code, it is also not as performant as class inheritance. Implicit delegation by inheritance needs constant time, explicit delegation is linear.\n\nIn Python (and of course Objective-C), delegation can be achieved with as little as one extra method to delegate to one or more classes. Altering the number of parameters of a delegated method often requires a change to only one module.\n\n
  19. http://stackoverflow.com/questions/5451926/is-message-passing-in-small-talk-and-objectivec-same-as-calling-method-with-valuOnce the actual function call is made, there is no difference. The difference between message passing and calling a method is in the linking. For languages like c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). With languages that use a messaging system like objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn&apos;t implement it, the class will usually either forward the message onto another object, or throw an exception. However, if the class does implement it, the runtime determines the address of the actual function, and calls it in the exact same manner as c (pushing the arguments and the return address onto the stack).\nOverall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.\nhttp://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance\nWith delegates, you can have one object be the delegate of many other objects. For example, you can have your MyController instance be the delegate of an NSTableView, an NSTextField, an NSWindow, and any other objects that compose your interface. This gives a compact place to put all of your user interface code related to one section of your UI.\nIf you&apos;d done that with subclassing, you&apos;d have to create one subclass every object you wanted callbacks from.\nNot only does delegation in C++ and Java mean writing more code, it is also not as performant as class inheritance. Implicit delegation by inheritance needs constant time, explicit delegation is linear. http://stackoverflow.com/questions/1209943/java-equivalent-of-cocoa-delegates-objective-c-informal-protocols?rq=1\n\nIn Python (and of course Objective-C), delegation can be achieved with as little as one extra method to delegate to one or more classes. Altering the number of parameters of a delegated method often requires a change to only one module.\n\n
  20. http://stackoverflow.com/questions/5451926/is-message-passing-in-small-talk-and-objectivec-same-as-calling-method-with-valuOnce the actual function call is made, there is no difference. The difference between message passing and calling a method is in the linking. For languages like c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). With languages that use a messaging system like objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn&apos;t implement it, the class will usually either forward the message onto another object, or throw an exception. However, if the class does implement it, the runtime determines the address of the actual function, and calls it in the exact same manner as c (pushing the arguments and the return address onto the stack).\nOverall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.\nhttp://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance\nWith delegates, you can have one object be the delegate of many other objects. For example, you can have your MyController instance be the delegate of an NSTableView, an NSTextField, an NSWindow, and any other objects that compose your interface. This gives a compact place to put all of your user interface code related to one section of your UI.\nIf you&apos;d done that with subclassing, you&apos;d have to create one subclass every object you wanted callbacks from.\nNot only does delegation in C++ and Java mean writing more code, it is also not as performant as class inheritance. Implicit delegation by inheritance needs constant time, explicit delegation is linear. http://stackoverflow.com/questions/1209943/java-equivalent-of-cocoa-delegates-objective-c-informal-protocols?rq=1\n\nIn Python (and of course Objective-C), delegation can be achieved with as little as one extra method to delegate to one or more classes. Altering the number of parameters of a delegated method often requires a change to only one module.\n\n
  21. http://stackoverflow.com/questions/5451926/is-message-passing-in-small-talk-and-objectivec-same-as-calling-method-with-valuOnce the actual function call is made, there is no difference. The difference between message passing and calling a method is in the linking. For languages like c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). With languages that use a messaging system like objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn&apos;t implement it, the class will usually either forward the message onto another object, or throw an exception. However, if the class does implement it, the runtime determines the address of the actual function, and calls it in the exact same manner as c (pushing the arguments and the return address onto the stack).\nOverall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.\nhttp://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance\nWith delegates, you can have one object be the delegate of many other objects. For example, you can have your MyController instance be the delegate of an NSTableView, an NSTextField, an NSWindow, and any other objects that compose your interface. This gives a compact place to put all of your user interface code related to one section of your UI.\nIf you&apos;d done that with subclassing, you&apos;d have to create one subclass every object you wanted callbacks from.\nNot only does delegation in C++ and Java mean writing more code, it is also not as performant as class inheritance. Implicit delegation by inheritance needs constant time, explicit delegation is linear. http://stackoverflow.com/questions/1209943/java-equivalent-of-cocoa-delegates-objective-c-informal-protocols?rq=1\n\nIn Python (and of course Objective-C), delegation can be achieved with as little as one extra method to delegate to one or more classes. Altering the number of parameters of a delegated method often requires a change to only one module.\n\n
  22. http://stackoverflow.com/questions/5451926/is-message-passing-in-small-talk-and-objectivec-same-as-calling-method-with-valuOnce the actual function call is made, there is no difference. The difference between message passing and calling a method is in the linking. For languages like c and c++ the function calls are linked at compile time with the linker (except with virtual functions which requires some runtime support). With languages that use a messaging system like objective-c and smalltalk, you cannot guarantee what functions will be run until runtime. The runtime determines if an object actually implements the function represented in the message. If it doesn&apos;t implement it, the class will usually either forward the message onto another object, or throw an exception. However, if the class does implement it, the runtime determines the address of the actual function, and calls it in the exact same manner as c (pushing the arguments and the return address onto the stack).\nOverall, a message is the same thing as calling a method directly, except the runtime finds the exact function to be called instead of it being linked at compile time.\nhttp://stackoverflow.com/questions/2068158/why-does-cocoa-use-delegates-rather-than-inheritance\nWith delegates, you can have one object be the delegate of many other objects. For example, you can have your MyController instance be the delegate of an NSTableView, an NSTextField, an NSWindow, and any other objects that compose your interface. This gives a compact place to put all of your user interface code related to one section of your UI.\nIf you&apos;d done that with subclassing, you&apos;d have to create one subclass every object you wanted callbacks from.\nNot only does delegation in C++ and Java mean writing more code, it is also not as performant as class inheritance. Implicit delegation by inheritance needs constant time, explicit delegation is linear. http://stackoverflow.com/questions/1209943/java-equivalent-of-cocoa-delegates-objective-c-informal-protocols?rq=1\n\nIn Python (and of course Objective-C), delegation can be achieved with as little as one extra method to delegate to one or more classes. Altering the number of parameters of a delegated method often requires a change to only one module.\n\n
  23. Don Han.\n\n
  24. A protocol is essentially a group of functions/methods.\n\nA class that extends itself with the protocol promises to implement the methods in the protocol (optional or required).\n
  25. Pre-written protocol called &amp;#x201C;CLLocationManagerDelegate&amp;#x201D; that we can use in our custom code.\n
  26. How do we use it? Our UIViewController extends itself with all the Core Location functionalities pre-written in CLLocationManagerDelegate!\n
  27. In our corresponding implementation file, we can use the methods declared in the CLLocationManagerDelegate!\n
  28. Open Xcode and show everything else\n
  29. \n
  30. (As seen earlier)\n
  31. This makes a lot of sense because we are essentially reusing a lot of established code already given to us by Apple&amp;#x2019;s Cocoa Touch framework in various blablaDelegate.h files.\n
  32. \n
  33. \n
  34. A parting message. What? Did I just contradict myself again?\n
  35. Not really... &amp;#x201C;Be water, my friend&amp;#x201D;\n
  36. \n
  37. \n