## Coordinating Async Operations
Daniel Saidi · [@danielsaidi](https://twitter.com/danielsaidi)
## Agenda
* Problem Definition
* 3rd Party Libraries
* Case Study
* Coding Session
* Discussions
## Problem Definition
* Coordinating async operations is tricky
* Serial vs. concurrent operations etc.
* Limited native support
* Completion blocks isn't enough
* We need more sophisticated ways
## Conclusion
* There are many 3rd party libraries for this
* Many are very powerful
* Many will affect your architecture
* Sometimes 3rd party libraries are not an option
## BookBeat
* Extensive offline support, for instance:
* Book actions (add/remove, listen/read, ratings etc.)
* Bookmarks
* Analytics
* Sync/update when the app comes online
## Sync/update
* Sync book actions (one by one, serial)
* Sync bookmarks (batches, concurrent)
* Sync analytics (batches, concurrent)
* Fetch latest data (many sources, concurrent)
## Problem
* Completely different needs for each operation
* Some operate on items, others on batches
* Some are serial, others concurrent
* Most must be coordinated, others can run in bg
* We don't want to use 3rd party dependencies
## Approach
* Describe the operations as protocols
* Find a good way to compose protocols
* Provide as much functionality as possible
* While still allowing customizations
* Composition over inheritance
# Thank you!
Daniel Saidi · [@danielsaidi](https://twitter.com/danielsaidi)