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

Modularization - Siggi Jonsson

Modularization - Siggi Jonsson

Since we took the stage at Droidcon NYC 2019 to talk about modularization at Tinder, our team and codebase have grown a lot and so has our project and build complexity. This talk will look back at some of the mistakes we made with our original modularization strategy and the impact that had on our engineering teams. We will look at the tools we used to analyze our dependency and build graphs, and how we identified bottlenecks in our processes. Finally, we will illustrate how we pivoted our strategy and restructured the project in a way that optimizes for the independence and efficiency of our feature teams and automates key decisions when it comes to dependency management, all without being disruptive to our engineering teams and ensuring we can continue evolving with the changing landscape of Android development.

Siggi Jónsson

June 02, 2022
Tweet

Other Decks in Technology

Transcript

  1. app

  2. Graph Assert Allowed Dependencies restricted = [ ':library:.* -> :feature:.*',

    '.*:public -> .*:internal’, '.*:internal -> .*:internal' ] moduleGraphAssert { maxHeight = 24 }
  3. Graph Assert Allowed Dependencies moduleGraphAssert { maxHeight = 24 restricted

    = [ ':library:.* -> :feature:.*', '.*:public -> .*:internal’, '.*:internal -> .*:internal' ] }
  4. Graph Assert Graph Generation digraph G { … “:chat:ui” ->

    “:common:datetime" “:chat:ui” -> ":common:dialog" ":chat:ui" -> ":chat:domain" ":chat:ui" -> “:safety-center:ui" ":chat:ui" -> ":profile:domain" … } $ gw generateModulesGraphvizText
  5. Graph Theory Betweenness centrality • Betweenness centrality is a way

    of detecting the amount of influence a node has over the flow of information in a graph. It is often used to find nodes that serve as a bridge from one part of a graph to another.
  6. Gephi Putting the metrics into action • Color: Modularity class

    • Node Size: Betweenness centrality • Layout: Force Atlas
  7. Putting graph theory to use Betweenness Centrality Correlations • Modules

    with too many responsibilities • Modules with unclear boundaries • Modules which had an outsized impact on build times
  8. Putting graph theory to use Capturing Metrics and Acting •

    Capture and report height • Capture and report betweenness centrality • Work towards reducing both, prioritizing the top ones
  9. • Simplified build graph • Improved feature and library isolation

    • Faster builds • Happier engineers Putting graph theory to use Results
  10. OK?

  11. Case Study Step 1: Add Graph Assert Plugin // app/build.gradle.kts

    plugins { ... id("com.jraska.module.graph.assertion") version “2.2.0” }
  12. Case Study Step 2: Generate Statistics $ gw generateModulesGraphStatistics GraphStatistics(

    modulesCount=14, edgesCount=39, height=4, longestPath=':app -> :feature-author -> :core-data -> :core-database -> :core-model’ )
  13. Case Study Step 3: Generate Graph File $ gw generateModulesGraphvizText

    -Pmodules.graph.output.gv=graph.gv GraphViz saved to graph.gv digraph G { ":app" -> ":feature-author" ":app" -> ":feature-interests" ":app" -> ":feature-foryou" ":app" -> ":feature-topic" ":app" -> ":core-ui" ":app" -> ":core-navigation" ... }
  14. • Node Color: Modularity class • Node Size: Betweenness centrality

    • Layout: Force Atlas Case Study Step 7: Adjust Appearance
  15. Case Study Now in Android [ ] Extract core-result out

    of core-common [ ] Extract repository interfaces out of core-data
  16. Case Study Now in Android [ ] Extract core-result out

    of core-common [ ] Extract repository interfaces out of core-data
  17. Case Study Now in Android [x] Extract core-result out of

    core-common [x] Extract repository interfaces out of core-data
  18. Case Study Step 3*: Skip to the insights $ gw

    generateModulesGraphNodeStatistics node betweennessCentrality degree inDegree outDegree height :core-data 18.00 10 5 5 2 :sync 2.10 5 1 4 3 :feature-author 1.10 6 1 5 3 :feature-topic 1.10 6 1 5 3 :feature-interests 0.77 5 1 4 3 :feature-foryou 0.77 5 1 4 3 :core-ui 0.17 6 5 1 1 :app 0.00 7 0 7 4 :core-model 0.00 9 9 0 0 :core-common 0.00 6 6 0 0 :core-database 0.00 2 1 1 1 :core-datastore 0.00 3 2 1 1 :core-network 0.00 3 1 2 1 :core-navigation 0.00 5 5 0 0 PR: github.com/jraska/modules-graph-assert/pull/176
  19. Case Study $ gw generateModulesGraphNodeStatistics node betweennessCentrality degree inDegree outDegree

    height :sync 5.17 5 1 4 3 :core-data 5.00 7 1 6 2 :feature-author 0.92 6 1 5 2 :feature-topic 0.92 6 1 5 2 :feature-interests 0.42 5 1 4 2 :feature-foryou 0.42 5 1 4 2 :core-ui 0.17 6 5 1 1 :app 0.00 7 0 7 4 :core-model 0.00 10 10 0 0 :core-data-public 0.00 6 5 1 1 :core-result 0.00 2 2 0 0 :core-navigation 0.00 5 5 0 0 :core-common 0.00 4 4 0 0 :core-database 0.00 2 1 1 1 :core-datastore 0.00 3 2 1 1 :core-network 0.00 3 1 2 1 Step 3*: Skip to the insights PR: github.com/jraska/modules-graph-assert/pull/176
  20. Summary Flatten the graph • Visualize dependencies using Graph Assert,

    GraphViz and Gephi • Capture and reduce graph height • Capture and reduce the betweenness centrality of module
  21. Thanks • Iñaki Villar - Tinder • Joseph Raska -

    Graph Assert • Gephi • JGraphT
  22. Thank You! Come see me at our booth for questions!

    Also, we’re hiring! lifeattinder.com @siggijons