SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

Destacado

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
 

Destacado (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
 

Similar a 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
 

Similar a 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"
 

Último

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
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
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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
 
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
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
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...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 
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
 

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