SlideShare a Scribd company logo
1 of 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

More Related Content

Viewers also liked

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
 

Viewers also liked (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 to 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 to 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"
 

Recently uploaded

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceOpsTree solutions
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 

Recently uploaded (20)

Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer Experience
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 

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