Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Building µfeatures

Building µfeatures

Part of the success of most mobile apps these days is having the ability to iterate and deliver features fast. This becomes a challenge when the project and the team grows, and dependencies and friction between teams become more apparent.

In this talk, I’ll introduce the concept of Microfeatures architecture for mobile apps. I’ll go through the core ideas behind it, show practical examples, and explain how development workflow has improved at SoundCloud since we started applying these principles.

Pedro Piñera Buendía

September 30, 2017
Tweet

More Decks by Pedro Piñera Buendía

Other Decks in Technology

Transcript

  1. –Esteban Torres “An app is the tiny cute boxes you

    have in your phone that show some other bigger boxes when you touch them.” Photo by Andreas Kind on Unsplash
  2. Building Search Background Synchroniser Home Session Settings Database Client Search

    Tests BS
 Tests Home
 Tests Session Tests Settings Tests Database Tests Client Tests APP TESTS Client Tests " #
  3. What is a µfeature µfeature Sources Tests App Source Source

    code (.swift / .h / .m) Resources (.ttf, .storyboard, .xib)
  4. Foundation µfeatures SCCore Client Reachability Keychain Logger Foundation Ext. SCTesting

    Custom assertions XCTest Ext. SCUI Fonts Colors Custom Views UIKit Ext.
  5. Product µfeatures SCSearch SCPlayback SCPayments SCOffline View where user can

    search for SoundCloud content Payment handling and subscription button/views Player queue handling and views Service to synchronise tracks
 offline
  6. Using µfeatures Product
 µfeature Application Product
 µfeature Product
 µfeature Product


    µfeature Navigation View Controller View Controller View Controller View Controller
  7. Using µfeatures Product
 µfeature Application Product
 µfeature Product
 µfeature Product


    µfeature Services Service Service Service Service Lifecycle Events External Events
  8. Dependency with Foundation Application (glue layer) Product Foundation Sources State-free

    component Creates an instance and uses it (e.g Font, Color, View) Stateful component A shared instance is retained from the app
 and shared with the features (e.g Client, Store, Analytics)
  9. Dependency between features Application (glue layer) A Sources Link between

    them Problem 1 It might eventually lead to circular dependencies that can’t be resolved B Sources Problem 2 We need to also compile dependencies, and their dependencies
  10. Dependency Inversion Application (glue layer) A Sources B Sources C

    Sources D Sources Dependency Inversion <B> <C> <D> <A> Foundation µfeatures
  11. Compiling A Application (glue layer) A Sources B C D

    Dependency Inversion <B> <C> <D> <A> Foundation µfeatures <B>
  12. Compiling the app Application (glue layer) A Sources B Sources

    C Sources D Sources Dependency Inversion <B> <C> <D> <A> Foundation µfeatures B
  13. Example: Home µfeature Home µfeature Core µfeature UI App class

    Client class Analytics class Logger client analytics logger View Controller Service Track Cell Colors Fonts
  14. µfeatures & Xcode Workspace App App Unit Tests UI Tests

    µfeature Sources Unit Tests Example app µfeature Sources Unit Tests Example app Pods Dependency 1 Dependency 2 Pods App Tests Feature Tests Feature Tests Per-project Schemes Features tests Features examples Features Workspace schemes
  15. Takeaways • Scale your project architecture with your team growth

    • Split things before they grow a lot. • Developers shouldn’t spend time fighting the tools. • Keep an eye on how your project/team evolves.
  16. References • Microservices: A definition of this new architectural term.

    • Introduction to Framework Programming Guide. • Embedding frameworks in an app. • Framework Oriented Programming. • Static & Dynamic libraries. • Modular Xcode projects.