Skip to content

Instantly share code, notes, and snippets.

@donnywals
Last active November 9, 2015 12:56
Show Gist options
  • Save donnywals/fb07d02ab7216dbc652d to your computer and use it in GitHub Desktop.
Save donnywals/fb07d02ab7216dbc652d to your computer and use it in GitHub Desktop.

Nikita Lutsenko - The Parse SDK: what’s inside?

  • Nikita is a developer at Facebook working on the Parse SDK
  • Parse is ±730 source files over 51000 lines of code, 150 Classes/Protocols and 2 people working on it. It’s one of the biggest, most advanced SDKs on the platform. It powers over 800 million active app-device pairs (july 2015). Internally Parse uses promises for asynchronous operations. It’s dependencies are loaded lazily. It’s written in Objective-C, works in Swift.
  • Promises are used to handle errors, deal with chaining, cancellation and serial/parallel work. Parse implements Bolt.framework to use promises. Normally you would use a function with a completion handler. If you would chain this you have to duplicate your error handling, you would drift right and code becomes messy. With Bolts you return a BFTask, if an error happend you return a BFTask with an error, otherwise you return your data.
  • Parse uses Instance vs Controller vs State.
    • Instance -> public API, Immutable state
    • State -> Current object state
    • Controller -> Acts on state Parse has a base state called PFBaseState and allows you to compare, isEqual and hash state. The PFFileState is an immutable state object. There’s also a mutable version that inherits from PFFileState.
  • Controllers, like PFFileController, are responsible for example for uploading and downloading files. These methods would accept a State. Parse uses something called a YoloController to make sure objects don’t float around after they’re supposed to be killed.
  • Question: Out of the box promises a+?
  • No, that’s a javascript thing. We haven’t had a reason to implement this.
  • Question: How does Bolts compare to PromiseKit
  • For one, we call our promises tasks and we have two different types. I looked into the API a while ago so I can’t really comment on the actual implementation.

Very technical complicated (and somewhat short) talk. Wish there were some more examples of how this all works in practice, how it translates to the code that I end up writing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment