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

November 27, 2017
Tweet

More Decks by Pedro Piñera Buendía

Other Decks in Technology

Transcript

  1. 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 " #
  2. What is a µfeature µfeature Sources Tests App Source Source

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

    Custom assertions XCTest Ext. SCUI Fonts Colors Custom Views UIKit Ext.
  4. 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
  5. Using µfeatures $ Product
 µfeature Application $ Product
 µfeature $

    Product
 µfeature $ Product
 µfeature Navigation View Controller View Controller View Controller View Controller
  6. Using µfeatures $ Product
 µfeature Application $ Product
 µfeature $

    Product
 µfeature $ Product
 µfeature Services Service Service Service Service Lifecycle Events External Events
  7. 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)
  8. 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
  9. Dependency Inversion Application (glue layer) A Sources B Sources C

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

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

    C Sources D Sources Dependency Inversion <B> <C> <D> <A> Foundation µfeatures B
  12. 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
  13. µ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 Example Feature Tests Example Per-project Schemes Features tests Features examples Features Workspace schemes
  14. Xcode Project Manager github.com/xcode-project-manager App Payments Core UI Generate Xcode

    Project UI Sources/**/* Tests/**/* Name Sources Tests Dependencies Core, Testing More configuration
  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. • Static & Dynamic libraries. • Modular Xcode projects.