Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0...
Transcript of Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0...
![Page 1: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/1.jpg)
Lessons learned while going from 0 to 1 with Mobile and GraphQL
Kamilah Taylor, @kamilahGraphQL Summit 2020
![Page 2: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/2.jpg)
2 | Confidential – Do Not Distribute
🇯🇲👩🏾🏫🤖📚👩🏾💻A little about me
![Page 3: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/3.jpg)
3 | Confidential – Do Not Distribute
🇯🇲👩🏾🏫🤖📚👩🏾💻A little about me
![Page 4: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/4.jpg)
4 | Confidential – Do Not Distribute
So you want to build an app and also use and learn GraphQL and evolve the schema at the same time
![Page 5: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/5.jpg)
When we started working on this app, there were three main questions that we had and that
we have continuously asked ourselves
![Page 6: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/6.jpg)
6 | Confidential – Do Not Distribute
🤨🧐🤔
So I’m using Apollo iOS in my app, what goes where?1
The schema is evolving! How do we keep up?2
So you’re telling me the engineering team has to think about multiple clients now?3
![Page 7: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/7.jpg)
Over time, we’ve worked out some answers for these, and
some things, we’re still working on
![Page 8: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/8.jpg)
Modular App Architecture + Apollo iOS
![Page 9: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/9.jpg)
9 | Confidential – Do Not Distribute
The problem with the monolithAnd why we architected our app modularly
● Swift codebases get large and unmanageable● Compile times increase● Libraries get tightly coupled to our code● Lots of merge conflicts
![Page 10: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/10.jpg)
10 | Confidential – Do Not Distribute
Our guiding architecture principles
● Modular app architecture● Enforce boundaries between modules● Practice encapsulation, especially for external dependencies● Use the coordinator pattern for navigation
![Page 11: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/11.jpg)
11 | Confidential – Do Not Distribute
Where we startedA couple of feature frameworks
![Page 12: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/12.jpg)
12 | Confidential – Do Not Distribute
Where we startedA couple of feature frameworks
![Page 13: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/13.jpg)
Problem we found:We have multiple feature
frameworks and needed all of them to access the data layer
without creating a dependency on apollo for every feature
framework
![Page 14: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/14.jpg)
14 | Confidential – Do Not Distribute
Enter: The DataService layerHow the feature frameworks talk to apollo
![Page 15: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/15.jpg)
15 | Confidential – Do Not Distribute
What this wins for usModularization
● We’re able to break our codebase up into modules● We also separate our infrastructure layer from our feature
layer● We set ourselves up to be able to pull some of our infra layer
modules out completely as shareable libraries
![Page 16: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/16.jpg)
16 | Confidential – Do Not Distribute
The DataServiceOur apollo workhorse
![Page 17: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/17.jpg)
17 | Confidential – Do Not Distribute
What this wins for usEncapsulation
● Our feature frameworks never need to know that Apollo is running under the hood
● We centralize how everyone interfaces with the data layer● We hide some of our details of what the network manager is
doing from the feature frameworks
![Page 18: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/18.jpg)
Solution we found: We used our modular app
architecture to encapsulate and create boundaries around Apollo and our data layer
![Page 19: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/19.jpg)
Active app development + an evolving schema
![Page 20: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/20.jpg)
20 | Confidential – Do Not Distribute
Build the app, define the schema, build the app, repeatAdd in some early experiments with mock data, realizations of how the schema should be defined and also some new use cases
![Page 21: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/21.jpg)
Problem we found: Over time our understanding of what we
needed the schema structure to be changed, and with active
feature development, sometimes the schema had to
be updated
![Page 22: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/22.jpg)
22 | Confidential – Do Not Distribute
Decoupling our code from the shape of the queries through the MVVM+Coordinator patternKeep data calls to just the view models and coordinators
![Page 23: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/23.jpg)
23 | Confidential – Do Not Distribute
What this wins for usMore encapsulation
● Within our feature frameworks, usually only our view models interact with our data layer and have knowledge of the GraphQL models
● Sometimes our coordinators end up with this job, usually when they’re handling a flow that’s spread across multiple views
![Page 24: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/24.jpg)
24 | Confidential – Do Not Distribute
Extensions to our GraphQL modelsIsolating the exact shape of the query where possible
● GraphQL generated models end up with deeply nested types that reveal the exact shape of the query
● We end up tightly coupling the shape of the query to everyone that needs to interact with the models
![Page 25: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/25.jpg)
25 | Confidential – Do Not Distribute
Extensions to our GraphQL modelsIsolating the exact shape of the query where possible
![Page 26: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/26.jpg)
26 | Confidential – Do Not Distribute
Extensions to our GraphQL modelsIsolating the exact shape of the query where possible
![Page 27: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/27.jpg)
Solution we found: We handle schema evolution by limiting access to the data layer using
patterns like MVVM, and decoupling the code from the shape of the schema by using
Swift extensions
![Page 28: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/28.jpg)
It’s a multiple client world - we just live in it
![Page 29: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/29.jpg)
Problem we found: The team was used to designing APIs for a
web client that lived with the backend, but now we had to figure out how to design for
multiple clients
![Page 30: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/30.jpg)
30 | Confidential – Do Not Distribute
Design the schemas to encapsulate business logicDon’t have your logic multiplied across clients
![Page 31: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/31.jpg)
31 | Confidential – Do Not Distribute
Design the schemas to encapsulate business logicDon’t have your logic multiplied across clients
![Page 32: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/32.jpg)
32 | Confidential – Do Not Distribute
Design the schemas to encapsulate business logicDon’t have your logic multiplied across clients
![Page 33: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/33.jpg)
33 | Confidential – Do Not Distribute
A few more things that have worked for usThis list will only keep growing!
● For client side strings, always interpolate them with business values returned from the schema
● GraphQL Interfaces and enums are powerful tools for lists of items where new item types could be added over time
● Coordinate deprecations by partnering cross functionally● Design schemas to product backwards compatible where possible
![Page 34: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/34.jpg)
Solution we found: We’ve embraced the multiple client world by designing GraphQL APIs to encapsulate business
logic, being product backwards compatible, and partnering across engineering teams
![Page 35: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/35.jpg)
35 | Confidential – Do Not Distribute
☺✌🏾😌
Apollo iOS lives in a data service layer and feature frameworks interact with the data service through their view models1
Decouple as much of the app as possible from the shape of the schema to handle schema evolution gracefully2
Embrace the multiple client life and design the schema to encapsulate business logic and be product backwards compatible
3
![Page 36: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/36.jpg)
36 | Confidential – Do Not Distribute
Victory
![Page 37: Lessons learned while going from 0 to 1 with Mobile and ... · Lessons learned while going from 0 to 1 with Mobile and GraphQL Kamilah Taylor, @kamilah GraphQL Summit 2020](https://reader035.fdocuments.us/reader035/viewer/2022063007/5fb894217016c6512e43ed6d/html5/thumbnails/37.jpg)