SlideShare une entreprise Scribd logo
1  sur  20
Blah blah
Blah blah
Blah blah
Blah blah !!!!#$!
App Store 2008:
-connected apps, showing real
time data! Whoa Nelly!
- in your pocket! Boom!
Communication OK?
XML? CSV? binary?
<myverylongtagname>
1
</myverylongtagname>
MyName, 1, 2, 5, left, TRUE
Other, 5, 4, 3, left, FALSE
0100001001100101001000
0001110011011101010111
0010011001010010000001
110100011011110
JSON
JSON is awesome
1) it’s very SIMPLE!
2) supported by tons of languages
3) structural data
• Step1: Stackoverflow
• Step2: click the link in approved answer
• Step3:
•
How to JSON?
Simplest approach
[[[[[json objectForKey:@”name”] objectAtIndex:1]
objectAtIndex: 2] objectForKey:@”value”] boolValue]
2009 code
2013 code
[json[@”name”][1][2][@”value”] boolValue]
never!
- json ... is nil ...
- EXC_BAD_ACCESS
- ... unrecognized selector ... [NSString boolValue]
- ... index out of bounds ...
Pros & Cons
• very quick code turnaround!!!
• no structure validation
• no data validation
• difficult to error handle
• it’s the road to maintenance
HELL!
evolution indicator
A better way!
NSDictionary* json = [NSJSONSerialization ... ];
if (json == nil) [self errorHandleEmptyJSON];
if (json[@”name”] == nil)
[self errorHandleEmptyName];
NSArray* name = json[@”name”];
if (name.count<1]
[self errorHandleWrongJSONStructure];
NSNumber* value = name[1][2][@”value”];
Forget much? oh noes...
Looks good so far, what’s left?
- validate the data for all values you use
- check if the incoming objects are of the
expected class type (yuicks!)
- make sure you decend into the JSON
according to the incoming structure
Pros & cons?
• Horribly slow to write code
• Difficult to maintain
• How do you recover from errors
in the middle of the parsing process???
• Better data validation
• Better structure validation
evolution indicator
Data models?
The “M” in MVC stands
for “MODEL”
Wrap up all the code in
classes for all your models
feels good!
Your models feature custom init
which reads the JSON and builds
up the model representation
All IF statements and all the error
handling is handled within the
model class
Other magic you coded at 4.17am on a Thursday
Pros & cons
• Using a class instead of NSDictionary
• OOP 4 Ever!
• Very flexible code
• Lot of redundant parsing code
• Lot of implementation
• Still harder to adapt to changes
evolution indicator
Then what?
Throughout 2012 I worked
mainly on JSON powered
applications.
In December I was already
fed-up with:
self.name = json[@”name”];
Eureka!
JSONModel
- import JSON
- structure validation
- data type validation
- data type conversion
- atomic operations
- error handling
Automatically does/has:
Import JSON
.h .m
For relatively simple models eliminates
the need to code in your .m file
Validation
@property (strong, nonatomic) NSString* name;
What you want is:
What you should be
getting might be:
{“name”:“Name”}
It is about what you want to have!
Conversion
@property (strong, nonatomic) NSURL* blogSiteUrl;
What you want is:
What you get is:
{“blogSiteUrl”:“http://www.yahoo.com”}
It is about what you want to have!
JSONModel
evolution indicator
Takes the hum-drum out of
coding
It’s very fast
Growing (testing) fan base
Thanks
www.JSONModel.com
Image credits:
http://www.clker.com
http://clipart.christiansunite.com
http://office.microsoft.com

Contenu connexe

En vedette

Some Successful Rabo Development Projects : Focus on Mobile
Some Successful Rabo Development Projects : Focus on MobileSome Successful Rabo Development Projects : Focus on Mobile
Some Successful Rabo Development Projects : Focus on MobileDan Armstrong
 
Mobile Financial Services - IBC / Singapore
Mobile Financial Services - IBC / SingaporeMobile Financial Services - IBC / Singapore
Mobile Financial Services - IBC / SingaporeDan Armstrong
 
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-VenturesMobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-VenturesDan Armstrong
 
Mobile Banking & Rabo Development Partner Banks
Mobile Banking & Rabo Development Partner BanksMobile Banking & Rabo Development Partner Banks
Mobile Banking & Rabo Development Partner BanksDan Armstrong
 
Mobile Convention Amsterdam - 22 May 2013
Mobile Convention Amsterdam - 22 May 2013Mobile Convention Amsterdam - 22 May 2013
Mobile Convention Amsterdam - 22 May 2013Dan Armstrong
 
Future of Web 2.0 - talk, 22 September 2009
Future of Web 2.0 - talk, 22 September 2009Future of Web 2.0 - talk, 22 September 2009
Future of Web 2.0 - talk, 22 September 2009Dan Armstrong
 
Rabo Development Retail Distribution & Channel Strategies & Successes
Rabo Development Retail Distribution & Channel Strategies & Successes Rabo Development Retail Distribution & Channel Strategies & Successes
Rabo Development Retail Distribution & Channel Strategies & Successes Dan Armstrong
 
Banking Distribution Overview
Banking Distribution OverviewBanking Distribution Overview
Banking Distribution OverviewDan Armstrong
 
M-Commerce World Summit 2011 - Introduction
M-Commerce World Summit 2011 - IntroductionM-Commerce World Summit 2011 - Introduction
M-Commerce World Summit 2011 - IntroductionDan Armstrong
 
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments DevelopmentRabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments DevelopmentDan Armstrong
 
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMOtechMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMODan Armstrong
 
The Consumer Side of NFC and Mobile Payments
The Consumer Side of NFC and Mobile PaymentsThe Consumer Side of NFC and Mobile Payments
The Consumer Side of NFC and Mobile PaymentsDan Armstrong
 
Mobey Forum - Case Study: Banking the Banked with NMB Mobile
Mobey Forum - Case Study: Banking the Banked with NMB MobileMobey Forum - Case Study: Banking the Banked with NMB Mobile
Mobey Forum - Case Study: Banking the Banked with NMB MobileDan Armstrong
 
Mobile Banking & Payments Update: September 2010
Mobile Banking & Payments Update: September 2010Mobile Banking & Payments Update: September 2010
Mobile Banking & Payments Update: September 2010Dan Armstrong
 
Rabo Development & Sustainable Distribution
Rabo Development & Sustainable DistributionRabo Development & Sustainable Distribution
Rabo Development & Sustainable DistributionDan Armstrong
 
Rabo Development Retail Distribution Case Study: Mobile Banking and Payments
Rabo Development Retail Distribution Case Study: Mobile Banking and PaymentsRabo Development Retail Distribution Case Study: Mobile Banking and Payments
Rabo Development Retail Distribution Case Study: Mobile Banking and PaymentsDan Armstrong
 
Africa - Mobile Convention Amsterdam
Africa - Mobile Convention AmsterdamAfrica - Mobile Convention Amsterdam
Africa - Mobile Convention AmsterdamDan Armstrong
 
Mobile Payments & Banking - NACHA Global Payments Forum
Mobile Payments & Banking - NACHA Global Payments ForumMobile Payments & Banking - NACHA Global Payments Forum
Mobile Payments & Banking - NACHA Global Payments ForumDan Armstrong
 

En vedette (19)

Some Successful Rabo Development Projects : Focus on Mobile
Some Successful Rabo Development Projects : Focus on MobileSome Successful Rabo Development Projects : Focus on Mobile
Some Successful Rabo Development Projects : Focus on Mobile
 
Mobile Financial Services - IBC / Singapore
Mobile Financial Services - IBC / SingaporeMobile Financial Services - IBC / Singapore
Mobile Financial Services - IBC / Singapore
 
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-VenturesMobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
Mobile Financial Services Distribution: Partnerships, Alliances & Joint-Ventures
 
Mobile Banking & Rabo Development Partner Banks
Mobile Banking & Rabo Development Partner BanksMobile Banking & Rabo Development Partner Banks
Mobile Banking & Rabo Development Partner Banks
 
Mobile Convention Amsterdam - 22 May 2013
Mobile Convention Amsterdam - 22 May 2013Mobile Convention Amsterdam - 22 May 2013
Mobile Convention Amsterdam - 22 May 2013
 
Future of Web 2.0 - talk, 22 September 2009
Future of Web 2.0 - talk, 22 September 2009Future of Web 2.0 - talk, 22 September 2009
Future of Web 2.0 - talk, 22 September 2009
 
Rabo Development Retail Distribution & Channel Strategies & Successes
Rabo Development Retail Distribution & Channel Strategies & Successes Rabo Development Retail Distribution & Channel Strategies & Successes
Rabo Development Retail Distribution & Channel Strategies & Successes
 
Banking Distribution Overview
Banking Distribution OverviewBanking Distribution Overview
Banking Distribution Overview
 
M-Commerce World Summit 2011 - Introduction
M-Commerce World Summit 2011 - IntroductionM-Commerce World Summit 2011 - Introduction
M-Commerce World Summit 2011 - Introduction
 
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments DevelopmentRabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
Rabo Mobiel & NMB Mobile: Mobile Banking & Payments Development
 
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMOtechMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
techMAP Amsterdam: What's trending in 2012? A focus on SOLOMO
 
The Consumer Side of NFC and Mobile Payments
The Consumer Side of NFC and Mobile PaymentsThe Consumer Side of NFC and Mobile Payments
The Consumer Side of NFC and Mobile Payments
 
Mobey Forum - Case Study: Banking the Banked with NMB Mobile
Mobey Forum - Case Study: Banking the Banked with NMB MobileMobey Forum - Case Study: Banking the Banked with NMB Mobile
Mobey Forum - Case Study: Banking the Banked with NMB Mobile
 
Mobile Banking & Payments Update: September 2010
Mobile Banking & Payments Update: September 2010Mobile Banking & Payments Update: September 2010
Mobile Banking & Payments Update: September 2010
 
BPR Mobile Banking
BPR Mobile BankingBPR Mobile Banking
BPR Mobile Banking
 
Rabo Development & Sustainable Distribution
Rabo Development & Sustainable DistributionRabo Development & Sustainable Distribution
Rabo Development & Sustainable Distribution
 
Rabo Development Retail Distribution Case Study: Mobile Banking and Payments
Rabo Development Retail Distribution Case Study: Mobile Banking and PaymentsRabo Development Retail Distribution Case Study: Mobile Banking and Payments
Rabo Development Retail Distribution Case Study: Mobile Banking and Payments
 
Africa - Mobile Convention Amsterdam
Africa - Mobile Convention AmsterdamAfrica - Mobile Convention Amsterdam
Africa - Mobile Convention Amsterdam
 
Mobile Payments & Banking - NACHA Global Payments Forum
Mobile Payments & Banking - NACHA Global Payments ForumMobile Payments & Banking - NACHA Global Payments Forum
Mobile Payments & Banking - NACHA Global Payments Forum
 

Similaire à JSONModel Lightning Talk

Battle of The Mocking Frameworks
Battle of The Mocking FrameworksBattle of The Mocking Frameworks
Battle of The Mocking FrameworksDror Helper
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxGCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxazida3
 
Dutch PHP Conference 2015 - The quest for global design principles
Dutch PHP Conference 2015 - The quest for global design principlesDutch PHP Conference 2015 - The quest for global design principles
Dutch PHP Conference 2015 - The quest for global design principlesMatthias Noback
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.WO Community
 
Generative Testing in Clojure
Generative Testing in ClojureGenerative Testing in Clojure
Generative Testing in ClojureAlistair Roche
 
2011 - SharePoint + jQuery
2011 - SharePoint + jQuery2011 - SharePoint + jQuery
2011 - SharePoint + jQueryChris O'Connor
 
Down With JavaScript!
Down With JavaScript!Down With JavaScript!
Down With JavaScript!Garth Gilmour
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWHolger Grosse-Plankermann
 
Core Data in RubyMotion #inspect
Core Data in RubyMotion #inspectCore Data in RubyMotion #inspect
Core Data in RubyMotion #inspectLori Olson
 
Managing and evolving JavaScript Code
Managing and evolving JavaScript CodeManaging and evolving JavaScript Code
Managing and evolving JavaScript CodeJean Carlo Emer
 
Test Driven Development - Workshop
Test Driven Development - WorkshopTest Driven Development - Workshop
Test Driven Development - WorkshopAnjana Somathilake
 
SQL Server 2016 JSON
SQL Server 2016 JSONSQL Server 2016 JSON
SQL Server 2016 JSONDavide Mauri
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Edward Burns
 
How to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysHow to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysBrett McLain
 
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDBBreaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDBMongoDB
 
Writing enterprise software error checking
Writing enterprise software error checkingWriting enterprise software error checking
Writing enterprise software error checkingRiversand Technologies
 
Using MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsUsing MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsWeaveworks
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDavide Mauri
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)Jia Mi
 
Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Mariia Havrylovych "Active learning and weak supervision in NLP projects"Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Mariia Havrylovych "Active learning and weak supervision in NLP projects"Fwdays
 

Similaire à JSONModel Lightning Talk (20)

Battle of The Mocking Frameworks
Battle of The Mocking FrameworksBattle of The Mocking Frameworks
Battle of The Mocking Frameworks
 
GCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptxGCSECS-DefensiveDesign.pptx
GCSECS-DefensiveDesign.pptx
 
Dutch PHP Conference 2015 - The quest for global design principles
Dutch PHP Conference 2015 - The quest for global design principlesDutch PHP Conference 2015 - The quest for global design principles
Dutch PHP Conference 2015 - The quest for global design principles
 
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
Beyond Fluffy Bunny. How I leveraged WebObjects in my lean startup.
 
Generative Testing in Clojure
Generative Testing in ClojureGenerative Testing in Clojure
Generative Testing in Clojure
 
2011 - SharePoint + jQuery
2011 - SharePoint + jQuery2011 - SharePoint + jQuery
2011 - SharePoint + jQuery
 
Down With JavaScript!
Down With JavaScript!Down With JavaScript!
Down With JavaScript!
 
Jest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRWJest: Frontend Testing richtig gemacht @WebworkerNRW
Jest: Frontend Testing richtig gemacht @WebworkerNRW
 
Core Data in RubyMotion #inspect
Core Data in RubyMotion #inspectCore Data in RubyMotion #inspect
Core Data in RubyMotion #inspect
 
Managing and evolving JavaScript Code
Managing and evolving JavaScript CodeManaging and evolving JavaScript Code
Managing and evolving JavaScript Code
 
Test Driven Development - Workshop
Test Driven Development - WorkshopTest Driven Development - Workshop
Test Driven Development - Workshop
 
SQL Server 2016 JSON
SQL Server 2016 JSONSQL Server 2016 JSON
SQL Server 2016 JSON
 
Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015Java EE 7 from an HTML5 Perspective, JavaLand 2015
Java EE 7 from an HTML5 Perspective, JavaLand 2015
 
How to build a SaaS solution in 60 days
How to build a SaaS solution in 60 daysHow to build a SaaS solution in 60 days
How to build a SaaS solution in 60 days
 
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDBBreaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
Breaking the Oracle Tie; High Performance OLTP and Analytics Using MongoDB
 
Writing enterprise software error checking
Writing enterprise software error checkingWriting enterprise software error checking
Writing enterprise software error checking
 
Using MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOpsUsing MLOps to Bring ML to Production/The Promise of MLOps
Using MLOps to Bring ML to Production/The Promise of MLOps
 
Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)John Resig Beijing 2010 (English Version)
John Resig Beijing 2010 (English Version)
 
Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Mariia Havrylovych "Active learning and weak supervision in NLP projects"Mariia Havrylovych "Active learning and weak supervision in NLP projects"
Mariia Havrylovych "Active learning and weak supervision in NLP projects"
 

Dernier

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 

Dernier (20)

Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 

JSONModel Lightning Talk

  • 1. Blah blah Blah blah Blah blah Blah blah !!!!#$! App Store 2008: -connected apps, showing real time data! Whoa Nelly! - in your pocket! Boom!
  • 2. Communication OK? XML? CSV? binary? <myverylongtagname> 1 </myverylongtagname> MyName, 1, 2, 5, left, TRUE Other, 5, 4, 3, left, FALSE 0100001001100101001000 0001110011011101010111 0010011001010010000001 110100011011110 JSON
  • 3. JSON is awesome 1) it’s very SIMPLE! 2) supported by tons of languages 3) structural data
  • 4. • Step1: Stackoverflow • Step2: click the link in approved answer • Step3: • How to JSON?
  • 5. Simplest approach [[[[[json objectForKey:@”name”] objectAtIndex:1] objectAtIndex: 2] objectForKey:@”value”] boolValue] 2009 code 2013 code [json[@”name”][1][2][@”value”] boolValue]
  • 6. never! - json ... is nil ... - EXC_BAD_ACCESS - ... unrecognized selector ... [NSString boolValue] - ... index out of bounds ...
  • 7. Pros & Cons • very quick code turnaround!!! • no structure validation • no data validation • difficult to error handle • it’s the road to maintenance HELL! evolution indicator
  • 8. A better way! NSDictionary* json = [NSJSONSerialization ... ]; if (json == nil) [self errorHandleEmptyJSON]; if (json[@”name”] == nil) [self errorHandleEmptyName]; NSArray* name = json[@”name”]; if (name.count<1] [self errorHandleWrongJSONStructure]; NSNumber* value = name[1][2][@”value”];
  • 9. Forget much? oh noes... Looks good so far, what’s left? - validate the data for all values you use - check if the incoming objects are of the expected class type (yuicks!) - make sure you decend into the JSON according to the incoming structure
  • 10. Pros & cons? • Horribly slow to write code • Difficult to maintain • How do you recover from errors in the middle of the parsing process??? • Better data validation • Better structure validation evolution indicator
  • 11. Data models? The “M” in MVC stands for “MODEL” Wrap up all the code in classes for all your models
  • 12. feels good! Your models feature custom init which reads the JSON and builds up the model representation All IF statements and all the error handling is handled within the model class Other magic you coded at 4.17am on a Thursday
  • 13. Pros & cons • Using a class instead of NSDictionary • OOP 4 Ever! • Very flexible code • Lot of redundant parsing code • Lot of implementation • Still harder to adapt to changes evolution indicator
  • 14. Then what? Throughout 2012 I worked mainly on JSON powered applications. In December I was already fed-up with: self.name = json[@”name”]; Eureka!
  • 15. JSONModel - import JSON - structure validation - data type validation - data type conversion - atomic operations - error handling Automatically does/has:
  • 16. Import JSON .h .m For relatively simple models eliminates the need to code in your .m file
  • 17. Validation @property (strong, nonatomic) NSString* name; What you want is: What you should be getting might be: {“name”:“Name”} It is about what you want to have!
  • 18. Conversion @property (strong, nonatomic) NSURL* blogSiteUrl; What you want is: What you get is: {“blogSiteUrl”:“http://www.yahoo.com”} It is about what you want to have!
  • 19. JSONModel evolution indicator Takes the hum-drum out of coding It’s very fast Growing (testing) fan base