SlideShare a Scribd company logo
1 of 39
Download to read offline
Interpreting Objective-C
@timburks
ν
“What’s new (nu)?”

Interpreting Objective-C. © Tim Burks. March 4, 2014
c/λ
“C over lambda.”

Interpreting Objective-C. © Tim Burks. March 4, 2014
Usage

Desire

Craft

Insight

Interpreting Objective-C. © Tim Burks. March 4, 2014
Desire

Interpreting Objective-C. © Tim Burks. March 4, 2014
Beliefs about Better

Interpreting Objective-C. © Tim Burks. March 4, 2014
1
In any resource-constrained
environment,
performance is everything.

Interpreting Objective-C. © Tim Burks. March 4, 2014
2
All environments of value
are resource-constrained.

Interpreting Objective-C. © Tim Burks. March 4, 2014
3
Performance is
device performance and
developer performance.

Interpreting Objective-C. © Tim Burks. March 4, 2014
4
The number of developers
required to create a system
is its biggest weakness.

Interpreting Objective-C. © Tim Burks. March 4, 2014
5
Stability and productivity are a
developer's top two priorities,
in that order.

Interpreting Objective-C. © Tim Burks. March 4, 2014
6
•

Simplicity allows speed.
Speed increases opportunity.

•

Simplicity allows control.
Control reduces risk.

Interpreting Objective-C. © Tim Burks. March 4, 2014
7
•

The C platform has consistently offered
the best run time/power/capability
performance for developers.

•

Lisp-style languages have offered the
greatest capabilities of abstraction.

Interpreting Objective-C. © Tim Burks. March 4, 2014
Insight

Interpreting Objective-C. © Tim Burks. March 4, 2014
Observation
Objective-C solves many problems in bridging C with
high level languages.
•

Introspectable: no glue code is needed to bind to
compiled objects.

•

Dynamic: we can add to the Objective-C runtime
at run time.

Interpreting Objective-C. © Tim Burks. March 4, 2014
So What’s Nu?

•

Nu is an interpreted dialect of Lisp that parses into
Objective C objects that can be evaluated to
perform computations.

•

Nu interacts directly with the Objective-C runtime to
create and use classes, methods, and objects.
Interpreting Objective-C. © Tim Burks. March 4, 2014
Craft

Interpreting Objective-C. © Tim Burks. March 4, 2014
Parsing Nu
(puts (+ 2 2))!
NuCell

NuCell

puts
Nu_puts_operator
NuCell

NuCell

NuCell

+

2

2

Nu_add_operator

NSNumber

NSNumber

Interpreting Objective-C. © Tim Burks. March 4, 2014
Evaluating Nu
- (id) evaluateWithContext:(NSMutableDictionary *) context
NuCell

NuCell

puts
Nu_puts_operator
NuCell

NuCell

NuCell

+

2

2

Nu_add_operator

NSNumber

NSNumber

Interpreting Objective-C. © Tim Burks. March 4, 2014
Operators
(+ 2 (/ 14 7)) !
!

Objects
(UIStoryboard storyboardWithName:name bundle:nil) !
!

Interpreting Objective-C. © Tim Burks. March 4, 2014
Interacting with the Runtime
((UIView alloc) initWithFrame:’(0 0 100 100))!
!

Nu evaluation can resolve symbols by looking up classes and
methods in the Objective-C runtime.
Nu evaluation uses Objective-C method signatures to make
method calls with appropriately-typed arguments.

Interpreting Objective-C. © Tim Burks. March 4, 2014
Interacting with the Runtime
(class MyClass is NSObject !
(- hello is !
(puts “hello")))

The Nu class operator can be used to define new classes
and to add methods to existing ones.

Interpreting Objective-C. © Tim Burks. March 4, 2014
The Nu Shell
% nush!
Nu Shell.!
% (class MyClass is NSObject !
(- hello is (puts "hello")))!
()!
% (set myobject (MyClass new))!
<MyClass:7fdb6863dd10>!
% (myobject hello)!
hello!
()!

Interpreting Objective-C. © Tim Burks. March 4, 2014
Usage

Interpreting Objective-C. © Tim Burks. March 4, 2014
Generate a plist
!
(set me (dict name:"Tim Burks"!
company:"Radtastical Inc."!
address:(dict street:"220 South California Avenue, Suite 250"!
city:"Palo Alto"!
state:"CA"!
zip:"94306")!
projects:(array (dict name:"Silicon Valley iOS Developers' Meetup"!
url:"http://meetup.com/sviphone")!
(dict name:"Renaissance"!
url:"http://renaissance.io")!
(dict name:"Open Radar"!
url:"http://openradar.io")!
(dict name:"Nu"!
url:"http://programming.nu"))))!

!

((me XMLPropertyListRepresentation) writeToFile:"tim.plist" atomically:NO)!

Interpreting Objective-C. © Tim Burks. March 4, 2014
<?xml version="1.0" encoding="UTF-8"?>!
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">!
<plist version="1.0">!
<dict>!
!
<key>address</key>!
!
<dict>!
!
!
<key>city</key>!
!
!
<string>Palo Alto</string>!
!
!
<key>state</key>!
!
!
<string>CA</string>!
!
!
<key>street</key>!
!
!
<string>220 South California Avenue, Suite 250</string>!
!
!
<key>zip</key>!
!
!
<string>94306</string>!
!
</dict>!
!
<key>company</key>!
!
<string>Radtastical Inc.</string>!
!
<key>name</key>!
!
<string>Tim Burks</string>!
!
<key>projects</key>!
!
<array>!
!
!
<dict>!
!
!
!
<key>name</key>!
!
!
!
<string>Silicon Valley iOS Developers' Meetup</string>!
!
!
!
<key>url</key>!
!
!
!
<string>http://meetup.com/sviphone</string>!
!
!
</dict>!
!
!
<dict>!
!
!
!
<key>name</key>!
!
!
!
<string>Renaissance</string>!
!
!
!
<key>url</key>!
!
!
!
<string>http://renaissance.io</string>!
!
!
</dict>!
!
!
<dict>!
!
!
!
<key>name</key>!
!
!
!
<string>Open Radar</string>!
!
!
!
<key>url</key>!
!
!
!
<string>http://openradar.io</string>!
!
!
</dict>!
!
!
<dict>!
!
!
!
<key>name</key>!
!
!
!
<string>Nu</string>!
!
!
!
<key>url</key>!
!
!
!
<string>http://programming.nu</string>!
!
!
</dict>!
!
</array>!
</dict>!
</plist>!

Interpreting Objective-C. © Tim Burks. March 4, 2014
Call a Remote API
;;!
;; test google geocoding API !
;; API is limited to 2500 requests/(ip-address*day)!
;;!

!

(load "RadHTTP")!
(load "RadJSON")!

!

(set street "1675 Owens Street")!
(set city "San Francisco")!
(set state "CA")!

!

(set parameters (dict sensor:"false"!
address:(+ street " "!
city ", "!
state " "!
)))!
(set query (parameters urlQueryString))!
(set path (+ "http://maps.googleapis.com/maps/api/geocode/json?" query))!
(set string (NSString stringWithContentsOfURL:(NSURL URLWithString:path)))!
(set geocoding (string JSONValue))!

!

(puts (geocoding description))
Interpreting Objective-C. © Tim Burks. March 4, 2014
{!
results =

!

(!

…!
!
geometry =
{!
location =
{!
lat = "37.76800009999999";!
lng = "-122.3934754";!
};!
"location_type" = ROOFTOP;!
viewport =
{!
northeast =
{!
lat = "37.76934908029149";!
lng = "-122.3921264197085";!
};!
southwest =
{!
lat = "37.7666511197085";!
lng = "-122.3948243802915";!
};!
};!
};!
types =
(!
"street_address"!
);!
}!
);!
status = OK;!
}!
Interpreting Objective-C. © Tim Burks. March 4, 2014
Write Unit Tests
;; test_array.nu!
;; tests for Nu array extensions.!
;;!
;; Copyright (c) 2007 Tim Burks, Radtastical Inc.!

!

(class TestArray is NuTestCase!
!
(- testCreate is!
(set a (NSMutableArray arrayWithList:'(1 2)))!
(a << "three")!
(assert_equal 3 (a count))!
(assert_equal 2 (a 1))!
(assert_equal "three" (a 2)))!

!

(- testEach is!
(set i 0)!
(set a (array 0 1 2))!
(a each:!
(do (x)!
(assert_equal i x)!
(set i (+ i 1))))!
;; iteration with break!
(set a (array 0 1 2 3 4 5 6))!
(set sum 0)!
(a each:!
(do (x)!

Interpreting Objective-C. © Tim Burks. March 4, 2014
[hebephrenia:~/nu] tim% nutest test/test_array.nu!

!
TestArray: running!
--- testCreate!
--- testEach!
--- testEachInReverse!
--- testEachWithIndex!
--- testIndexing!
--- testSortUsingBlock!
--- testSortedArrayUsingBlock!
--- testSortedArrayUsingSelector!
TestArray: completed 8 tests/32 assertions/0 failures/0 errors!

!
2014-03-03 19:52:41.147 nush[10592:d07] All: completed 8 tests/32
assertions/0 failures/0 errors!

!
2014-03-03 19:52:41.148 nush[10592:d07] SUCCESS (0 failures, 0 errors)

Interpreting Objective-C. © Tim Burks. March 4, 2014
Build iOS apps
<dict>
<key>action</key>
<string>push sessions/2014/day/1</string>
<key>image</key>
<dict>
<key>filename</key>
<string>2014_bill_budge.jpg</string>
<key>mask</key>
<string>circle</string>
<key>position</key>
<string>left</string>
</dict>
<key>markdown</key>
<string>Wednesday, January 29, 2014n# Inspiration</string>
</dict>
Interpreting Objective-C. © Tim Burks. March 4, 2014
Interpreting Objective-C. © Tim Burks. March 4, 2014
Create Web Sites

Interpreting Objective-C. © Tim Burks. March 4, 2014
(get "/radarid:"!
(set radarnumber (radarid longLongValue))!
(authenticate)!
(set mongo (RadMongoDB new))!
(mongo connect)!
(set radar (mongo findOne:(dict number:radarnumber) inCollection:"openradar.radars"))!
(if (and (radarid longLongValue) radar)!
(then (set comments (mongo findArray:(dict $query:(dict radar_id:(radar _id:))!
$orderby:(dict created:1))!
inCollection:"openradar.comments"))!
(htmlpage (+ "Radar " (radar number:))!
(topbar)!
(&div class:"row"!
(&div class:"large-12 small-12 columns"!
(panel-for-radar radar)))!
(&div class:"row"!
(&div class:"large-12 small-12 columns"!
(&div class:"row"!
(&div class:"large-2 medium-2 small-12 large-push-10 medium-push-10 columns" style:"text-align:right"!
(if (eq (radar user:) screen_name)!
(then (&a class:"button" href:(+ "/radars/edit/" (radar _id:)) "Edit"))!
(else nil))!
(field "Number" (radar number:))!
(field "Originator" (mask-username (radar user:)))!
(field "Date Originated" (radar originated:))!
(field "Status" (radar status:))!
(field "Resolved" (radar resolved:))!
(field "Product" (radar product:))!
(field "Product Version" (radar product_version:))!
(field "Classification" (radar classification:))!
(field "Reproducible" (radar reproducible:)))!
(&div class:"large-10 large-pull-2 medium-10 medium-pull-2 small-12 columns" style:"padding:0 30px;"!
(&p style:"white-space: pre-wrap; word-wrap: break-word; font-family:Courier, monospace; font-size:80%"!
(if ((set description (radar description:)) length)!
(then (escape (radar description:)))!
(else (&em "No description provided."))))))!
(&div class:"row"!
(&div class:"large-10 medium-10 small-12 columns"!
(&div class:"comments"!
(comments map:!
(do (comment)!
(if (comment parent_id:)!
(then "") ;; skip replies!
(else (box-for-comment comment YES screen_name))))))))!
(if screen_name!
(then (&input id:"newcomment" type:"button" class:"button tiny" value:"Post a comment"))!
(else (&p (&a href:"/signin" "Sign in") " to post comments and radars.")))!
(&div style:"display:none;" id:"radar" (radar _id:))!
(&br)!
(&script type:"text/javascript" charset:"utf-8"!
"if(jQuery("#error").text() == "") jQuery("#error").hide();")))))!
(else nil)))!

Interpreting Objective-C. © Tim Burks. March 4, 2014
http://programming.nu/posts/2013/04/14/Nu-2.1.0
Interpreting Objective-C. © Tim Burks. March 4, 2014
Interpreting Objective-C. © Tim Burks. March 4, 2014
Anywhere Objective-C is run

Interpreting Objective-C. © Tim Burks. March 4, 2014
Usage

Desire

Craft

Insight

Interpreting Objective-C. © Tim Burks. March 4, 2014
MYNetwork
objective-git
UIKit
Pantomime CocoaYAML
NSURLRequest
OTRKit
MailCore
SpriteKit
SocketRocket
NSKeyedArchiver
google-api-objectivec-client
PDFKit SSKeychain FMDB
NSJSONSerialization
CorePlot
SSZipArchive PostgreSQL
NSXPCConnection
NSPropertyListSerialization
PocketSVG AFNetworking
MongoDB
NSRegularExpression NSXMLDocument
RestKit Xapian
NSFileHandle
MySQL
NSSet
PorterStemmer
NSValue
levelDB
NSProcessInfo
Simple-KML
redis
NSNumber
SQLite
NSDictionary
libevent
NSArray
OpenGL
libxml2
NSString
NSURLSession

AppKit

Usage

Desire

Batteries Nuclear Power Included
Craft

http://programming.nu

Insight

Interpreting Objective-C. © Tim Burks. March 4, 2014

More Related Content

Similar to Interpreting Objective-C Guide

TDD Painkillers
TDD PainkillersTDD Painkillers
TDD PainkillersBen Hall
 
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...Rudy Jahchan
 
20160913 cookpad ios_en
20160913 cookpad ios_en20160913 cookpad ios_en
20160913 cookpad ios_enKazuaki Matsuo
 
Turbocharge your automated tests with ci
Turbocharge your automated tests with ciTurbocharge your automated tests with ci
Turbocharge your automated tests with ciOpenSource Connections
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Dockertoffermann
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In ActionJon Kruger
 
Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Bert Brouns
 
End to End immutable infrastructure testing
End to End immutable infrastructure testingEnd to End immutable infrastructure testing
End to End immutable infrastructure testingNebulaworks
 
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)Jernej Kavka (JK)
 
FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023Matthew Groves
 
WilliamBosch_2016Resume
WilliamBosch_2016ResumeWilliamBosch_2016Resume
WilliamBosch_2016ResumeWilliam Bosch
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven DevelopmentPablo Villar
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesTao Xie
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardJAX London
 
Telephone directory in c
Telephone directory in cTelephone directory in c
Telephone directory in cUpendra Sengar
 
JustEnoughDevOpsForDataScientists
JustEnoughDevOpsForDataScientistsJustEnoughDevOpsForDataScientists
JustEnoughDevOpsForDataScientistsAnya Bida
 

Similar to Interpreting Objective-C Guide (20)

TDD Painkillers
TDD PainkillersTDD Painkillers
TDD Painkillers
 
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
iOSDevCamp 2011 - Getting "Test"-y: Test Driven Development & Automated Deplo...
 
20160913 cookpad ios_en
20160913 cookpad ios_en20160913 cookpad ios_en
20160913 cookpad ios_en
 
Driving development in PHP
Driving development in PHPDriving development in PHP
Driving development in PHP
 
ShwetaKBijay-resume
ShwetaKBijay-resumeShwetaKBijay-resume
ShwetaKBijay-resume
 
TDD and Getting Paid
TDD and Getting PaidTDD and Getting Paid
TDD and Getting Paid
 
Turbocharge your automated tests with ci
Turbocharge your automated tests with ciTurbocharge your automated tests with ci
Turbocharge your automated tests with ci
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
Testing with Docker
Testing with DockerTesting with Docker
Testing with Docker
 
Test-Driven Development In Action
Test-Driven Development In ActionTest-Driven Development In Action
Test-Driven Development In Action
 
Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.Techorama 2017 - Testing the unit, and beyond.
Techorama 2017 - Testing the unit, and beyond.
 
End to End immutable infrastructure testing
End to End immutable infrastructure testingEnd to End immutable infrastructure testing
End to End immutable infrastructure testing
 
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
From Paper to Power using Azure Form Recognizer (Azure Sydney UG 2020)
 
FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023FluentMigrator - Dayton .NET - July 2023
FluentMigrator - Dayton .NET - July 2023
 
WilliamBosch_2016Resume
WilliamBosch_2016ResumeWilliamBosch_2016Resume
WilliamBosch_2016Resume
 
iOS Test-Driven Development
iOS Test-Driven DevelopmentiOS Test-Driven Development
iOS Test-Driven Development
 
Automated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and ChallengesAutomated Developer Testing: Achievements and Challenges
Automated Developer Testing: Achievements and Challenges
 
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted NewardArchitecture | Busy Java Developers Guide to NoSQL | Ted Neward
Architecture | Busy Java Developers Guide to NoSQL | Ted Neward
 
Telephone directory in c
Telephone directory in cTelephone directory in c
Telephone directory in c
 
JustEnoughDevOpsForDataScientists
JustEnoughDevOpsForDataScientistsJustEnoughDevOpsForDataScientists
JustEnoughDevOpsForDataScientists
 

More from Tim Burks

Governing APIs at Scale
Governing APIs at ScaleGoverning APIs at Scale
Governing APIs at ScaleTim Burks
 
Usable APIs at Scale
Usable APIs at ScaleUsable APIs at Scale
Usable APIs at ScaleTim Burks
 
Build your next REST API with gRPC
Build your next REST API with gRPCBuild your next REST API with gRPC
Build your next REST API with gRPCTim Burks
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCTim Burks
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Tim Burks
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swiftTim Burks
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationTim Burks
 
Taming Cloud APIs with Swift
Taming Cloud APIs with SwiftTaming Cloud APIs with Swift
Taming Cloud APIs with SwiftTim Burks
 
OpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideTim Burks
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCTim Burks
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCTim Burks
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleTim Burks
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsTim Burks
 
Deep Geek Diving into the iPhone OS and Frameworks
Deep Geek Diving into the iPhone OS and FrameworksDeep Geek Diving into the iPhone OS and Frameworks
Deep Geek Diving into the iPhone OS and FrameworksTim Burks
 
Building Open Radar
Building Open RadarBuilding Open Radar
Building Open RadarTim Burks
 

More from Tim Burks (15)

Governing APIs at Scale
Governing APIs at ScaleGoverning APIs at Scale
Governing APIs at Scale
 
Usable APIs at Scale
Usable APIs at ScaleUsable APIs at Scale
Usable APIs at Scale
 
Build your next REST API with gRPC
Build your next REST API with gRPCBuild your next REST API with gRPC
Build your next REST API with gRPC
 
Implementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPCImplementing OpenAPI and GraphQL services with gRPC
Implementing OpenAPI and GraphQL services with gRPC
 
Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)Creating Great REST and gRPC API Experiences (in Swift)
Creating Great REST and gRPC API Experiences (in Swift)
 
Networked APIs with swift
Networked APIs with swiftNetworked APIs with swift
Networked APIs with swift
 
Enforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code GenerationEnforcing API Design Rules for High Quality Code Generation
Enforcing API Design Rules for High Quality Code Generation
 
Taming Cloud APIs with Swift
Taming Cloud APIs with SwiftTaming Cloud APIs with Swift
Taming Cloud APIs with Swift
 
OpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-SideOpenAPI and gRPC Side by-Side
OpenAPI and gRPC Side by-Side
 
Fast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPCFast and Reliable Swift APIs with gRPC
Fast and Reliable Swift APIs with gRPC
 
Build Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPCBuild Great Networked APIs with Swift, OpenAPI, and gRPC
Build Great Networked APIs with Swift, OpenAPI, and gRPC
 
What I learned about APIs in my first year at Google
What I learned about APIs in my first year at GoogleWhat I learned about APIs in my first year at Google
What I learned about APIs in my first year at Google
 
CocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIsCocoaConf: The Language of Mobile Software is APIs
CocoaConf: The Language of Mobile Software is APIs
 
Deep Geek Diving into the iPhone OS and Frameworks
Deep Geek Diving into the iPhone OS and FrameworksDeep Geek Diving into the iPhone OS and Frameworks
Deep Geek Diving into the iPhone OS and Frameworks
 
Building Open Radar
Building Open RadarBuilding Open Radar
Building Open Radar
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 

Interpreting Objective-C Guide

  • 2. ν “What’s new (nu)?” Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 3. c/λ “C over lambda.” Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 5. Desire Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 6. Beliefs about Better Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 7. 1 In any resource-constrained environment, performance is everything. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 8. 2 All environments of value are resource-constrained. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 9. 3 Performance is device performance and developer performance. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 10. 4 The number of developers required to create a system is its biggest weakness. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 11. 5 Stability and productivity are a developer's top two priorities, in that order. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 12. 6 • Simplicity allows speed. Speed increases opportunity. • Simplicity allows control. Control reduces risk. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 13. 7 • The C platform has consistently offered the best run time/power/capability performance for developers. • Lisp-style languages have offered the greatest capabilities of abstraction. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 14. Insight Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 15. Observation Objective-C solves many problems in bridging C with high level languages. • Introspectable: no glue code is needed to bind to compiled objects. • Dynamic: we can add to the Objective-C runtime at run time. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 16. So What’s Nu? • Nu is an interpreted dialect of Lisp that parses into Objective C objects that can be evaluated to perform computations. • Nu interacts directly with the Objective-C runtime to create and use classes, methods, and objects. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 17. Craft Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 18. Parsing Nu (puts (+ 2 2))! NuCell NuCell puts Nu_puts_operator NuCell NuCell NuCell + 2 2 Nu_add_operator NSNumber NSNumber Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 19. Evaluating Nu - (id) evaluateWithContext:(NSMutableDictionary *) context NuCell NuCell puts Nu_puts_operator NuCell NuCell NuCell + 2 2 Nu_add_operator NSNumber NSNumber Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 20. Operators (+ 2 (/ 14 7)) ! ! Objects (UIStoryboard storyboardWithName:name bundle:nil) ! ! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 21. Interacting with the Runtime ((UIView alloc) initWithFrame:’(0 0 100 100))! ! Nu evaluation can resolve symbols by looking up classes and methods in the Objective-C runtime. Nu evaluation uses Objective-C method signatures to make method calls with appropriately-typed arguments. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 22. Interacting with the Runtime (class MyClass is NSObject ! (- hello is ! (puts “hello"))) The Nu class operator can be used to define new classes and to add methods to existing ones. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 23. The Nu Shell % nush! Nu Shell.! % (class MyClass is NSObject ! (- hello is (puts "hello")))! ()! % (set myobject (MyClass new))! <MyClass:7fdb6863dd10>! % (myobject hello)! hello! ()! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 24. Usage Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 25. Generate a plist ! (set me (dict name:"Tim Burks"! company:"Radtastical Inc."! address:(dict street:"220 South California Avenue, Suite 250"! city:"Palo Alto"! state:"CA"! zip:"94306")! projects:(array (dict name:"Silicon Valley iOS Developers' Meetup"! url:"http://meetup.com/sviphone")! (dict name:"Renaissance"! url:"http://renaissance.io")! (dict name:"Open Radar"! url:"http://openradar.io")! (dict name:"Nu"! url:"http://programming.nu"))))! ! ((me XMLPropertyListRepresentation) writeToFile:"tim.plist" atomically:NO)! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 26. <?xml version="1.0" encoding="UTF-8"?>! <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">! <plist version="1.0">! <dict>! ! <key>address</key>! ! <dict>! ! ! <key>city</key>! ! ! <string>Palo Alto</string>! ! ! <key>state</key>! ! ! <string>CA</string>! ! ! <key>street</key>! ! ! <string>220 South California Avenue, Suite 250</string>! ! ! <key>zip</key>! ! ! <string>94306</string>! ! </dict>! ! <key>company</key>! ! <string>Radtastical Inc.</string>! ! <key>name</key>! ! <string>Tim Burks</string>! ! <key>projects</key>! ! <array>! ! ! <dict>! ! ! ! <key>name</key>! ! ! ! <string>Silicon Valley iOS Developers' Meetup</string>! ! ! ! <key>url</key>! ! ! ! <string>http://meetup.com/sviphone</string>! ! ! </dict>! ! ! <dict>! ! ! ! <key>name</key>! ! ! ! <string>Renaissance</string>! ! ! ! <key>url</key>! ! ! ! <string>http://renaissance.io</string>! ! ! </dict>! ! ! <dict>! ! ! ! <key>name</key>! ! ! ! <string>Open Radar</string>! ! ! ! <key>url</key>! ! ! ! <string>http://openradar.io</string>! ! ! </dict>! ! ! <dict>! ! ! ! <key>name</key>! ! ! ! <string>Nu</string>! ! ! ! <key>url</key>! ! ! ! <string>http://programming.nu</string>! ! ! </dict>! ! </array>! </dict>! </plist>! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 27. Call a Remote API ;;! ;; test google geocoding API ! ;; API is limited to 2500 requests/(ip-address*day)! ;;! ! (load "RadHTTP")! (load "RadJSON")! ! (set street "1675 Owens Street")! (set city "San Francisco")! (set state "CA")! ! (set parameters (dict sensor:"false"! address:(+ street " "! city ", "! state " "! )))! (set query (parameters urlQueryString))! (set path (+ "http://maps.googleapis.com/maps/api/geocode/json?" query))! (set string (NSString stringWithContentsOfURL:(NSURL URLWithString:path)))! (set geocoding (string JSONValue))! ! (puts (geocoding description)) Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 28. {! results = ! (! …! ! geometry = {! location = {! lat = "37.76800009999999";! lng = "-122.3934754";! };! "location_type" = ROOFTOP;! viewport = {! northeast = {! lat = "37.76934908029149";! lng = "-122.3921264197085";! };! southwest = {! lat = "37.7666511197085";! lng = "-122.3948243802915";! };! };! };! types = (! "street_address"! );! }! );! status = OK;! }! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 29. Write Unit Tests ;; test_array.nu! ;; tests for Nu array extensions.! ;;! ;; Copyright (c) 2007 Tim Burks, Radtastical Inc.! ! (class TestArray is NuTestCase! ! (- testCreate is! (set a (NSMutableArray arrayWithList:'(1 2)))! (a << "three")! (assert_equal 3 (a count))! (assert_equal 2 (a 1))! (assert_equal "three" (a 2)))! ! (- testEach is! (set i 0)! (set a (array 0 1 2))! (a each:! (do (x)! (assert_equal i x)! (set i (+ i 1))))! ;; iteration with break! (set a (array 0 1 2 3 4 5 6))! (set sum 0)! (a each:! (do (x)! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 30. [hebephrenia:~/nu] tim% nutest test/test_array.nu! ! TestArray: running! --- testCreate! --- testEach! --- testEachInReverse! --- testEachWithIndex! --- testIndexing! --- testSortUsingBlock! --- testSortedArrayUsingBlock! --- testSortedArrayUsingSelector! TestArray: completed 8 tests/32 assertions/0 failures/0 errors! ! 2014-03-03 19:52:41.147 nush[10592:d07] All: completed 8 tests/32 assertions/0 failures/0 errors! ! 2014-03-03 19:52:41.148 nush[10592:d07] SUCCESS (0 failures, 0 errors) Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 31. Build iOS apps <dict> <key>action</key> <string>push sessions/2014/day/1</string> <key>image</key> <dict> <key>filename</key> <string>2014_bill_budge.jpg</string> <key>mask</key> <string>circle</string> <key>position</key> <string>left</string> </dict> <key>markdown</key> <string>Wednesday, January 29, 2014n# Inspiration</string> </dict> Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 32. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 33. Create Web Sites Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 34. (get "/radarid:"! (set radarnumber (radarid longLongValue))! (authenticate)! (set mongo (RadMongoDB new))! (mongo connect)! (set radar (mongo findOne:(dict number:radarnumber) inCollection:"openradar.radars"))! (if (and (radarid longLongValue) radar)! (then (set comments (mongo findArray:(dict $query:(dict radar_id:(radar _id:))! $orderby:(dict created:1))! inCollection:"openradar.comments"))! (htmlpage (+ "Radar " (radar number:))! (topbar)! (&div class:"row"! (&div class:"large-12 small-12 columns"! (panel-for-radar radar)))! (&div class:"row"! (&div class:"large-12 small-12 columns"! (&div class:"row"! (&div class:"large-2 medium-2 small-12 large-push-10 medium-push-10 columns" style:"text-align:right"! (if (eq (radar user:) screen_name)! (then (&a class:"button" href:(+ "/radars/edit/" (radar _id:)) "Edit"))! (else nil))! (field "Number" (radar number:))! (field "Originator" (mask-username (radar user:)))! (field "Date Originated" (radar originated:))! (field "Status" (radar status:))! (field "Resolved" (radar resolved:))! (field "Product" (radar product:))! (field "Product Version" (radar product_version:))! (field "Classification" (radar classification:))! (field "Reproducible" (radar reproducible:)))! (&div class:"large-10 large-pull-2 medium-10 medium-pull-2 small-12 columns" style:"padding:0 30px;"! (&p style:"white-space: pre-wrap; word-wrap: break-word; font-family:Courier, monospace; font-size:80%"! (if ((set description (radar description:)) length)! (then (escape (radar description:)))! (else (&em "No description provided."))))))! (&div class:"row"! (&div class:"large-10 medium-10 small-12 columns"! (&div class:"comments"! (comments map:! (do (comment)! (if (comment parent_id:)! (then "") ;; skip replies! (else (box-for-comment comment YES screen_name))))))))! (if screen_name! (then (&input id:"newcomment" type:"button" class:"button tiny" value:"Post a comment"))! (else (&p (&a href:"/signin" "Sign in") " to post comments and radars.")))! (&div style:"display:none;" id:"radar" (radar _id:))! (&br)! (&script type:"text/javascript" charset:"utf-8"! "if(jQuery("#error").text() == "") jQuery("#error").hide();")))))! (else nil)))! Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 36. Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 37. Anywhere Objective-C is run Interpreting Objective-C. © Tim Burks. March 4, 2014
  • 39. MYNetwork objective-git UIKit Pantomime CocoaYAML NSURLRequest OTRKit MailCore SpriteKit SocketRocket NSKeyedArchiver google-api-objectivec-client PDFKit SSKeychain FMDB NSJSONSerialization CorePlot SSZipArchive PostgreSQL NSXPCConnection NSPropertyListSerialization PocketSVG AFNetworking MongoDB NSRegularExpression NSXMLDocument RestKit Xapian NSFileHandle MySQL NSSet PorterStemmer NSValue levelDB NSProcessInfo Simple-KML redis NSNumber SQLite NSDictionary libevent NSArray OpenGL libxml2 NSString NSURLSession AppKit Usage Desire Batteries Nuclear Power Included Craft http://programming.nu Insight Interpreting Objective-C. © Tim Burks. March 4, 2014