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

Large Scale Modularization

Erik Kamp
December 05, 2017

Large Scale Modularization

Ever wonder what it takes to fully modularize a large application and begin working on instant apps? Wonder no more, in this talk we review how we tackled the problem of modularization, and package separation within the large Groupon Android App.

Erik Kamp

December 05, 2017
Tweet

More Decks by Erik Kamp

Other Decks in Technology

Transcript

  1. 3 We need an Instant App! It’s taking too long

    to build! LemonAide - Good For the Soul!
  2. Why Modularize - BUILD SPEED 9 Compile Avoidance Calorie Tracker

    Module class Recompiles Users Module Depends on Recipes Module
  3. Why Modularize - BUILD SPEED 10 Potential Problem with Multiple

    Modules variant Checkout Calorie Tracker Main Recipes Our Builds are taking longer!!
  4. Why Modularize - BUILD SPEED 13 Remote Build Cache “Faster

    builds with build cache.” Build cache | Gradle Inc., Gradle, gradle.com/build-cache.
  5. Methodology - COMMUNICATING 19 Hosting Meetings Speaking With Managers Business

    Reasoning • Conveying the Big Picture • How will this help my team? • How will this grow the business?
  6. Methodology - AGREEING ON A STRUCTURE 20 How are we

    going to layer the packages? • Feature-wise • Team-wise • Type / Layered
  7. Methodology - AGREEING ON A STRUCTURE 21 Team Based SUGAR

    TEAM RECIPES CALORIE TRACKER FRAGMENTS ACTIVITIES FRAGMENTS ACTIVITIES CALORIE TRACKER LEMON TEAM SUGAR TEAM Feature Based
  8. Methodology - EXPERIMENTING 22 Very little information Highly Coupled Code

    Navigation • Scholarly Resources • Blog Posts • Difficulties separating out • Automation • Activities • Intent Builders
  9. Methodology - EXPERIMENT 23 • Module creation • Research •

    Negotiation • New Norms Experiment Experiment Scale Up Communication
  10. Methodology - SCALING UP 24 Peer Programming Two way communication

    • Guiding • Convincing • Optimization • “Real World”
  11. Methodology - SCALE UP 25 • Module creation • Research

    • Negotiation • New Norms Experiment Scale Up • Who to include • How quickly to intro changes Scale Up Communication
  12. Techniques - DEPENDENCY GRAPH 29 .class files Dot file Dependency

    graph classcycle* to PNG** ** https://www.graphviz.org/ * http://classycle.sourceforge.net/
  13. Techniques - CYCLES - DETECTION 34 FindBugs - Cycle Detection

    Plugin • Comprehensive Report • Already present in our project
  14. Techniques - CYCLES - FindBugs - Report 35 Summary: Input

    file is "findCyclesRelease.xml” 63 cycles detected. They are white-listed in white-list.json
  15. Techniques - REGRESSION PREVENTION 40 • Prevent growth of deprecated

    packages Webhooks Scripts • Prevent new cycle creation • Monitor module dependencies
  16. Tooling - INTERFACE TECHNIQUE 48 In Recipe Module: define the

    interface public interface Recipe_Ingredients { // methods needed by new module boolean isGlutenFree(); } In Main Module public class Ingredients { boolean isGlutenFree() { // code that implements the method } } : implement the interface implements Recipe_Ingredients { @Override
  17. Tooling - INTERFACE TECHNIQUE 49 In Main Module: Glue them

    together ... { public RecipeInterfaceBinder() { bind(Recipe_Ingredients).to(Ingredients); } }
  18. Techniques - INTERFACE TECHNIQUE 50 • Quickly Move classes Benefits

    • Exposes dependencies • Feature modules
  19. Techniques - INTERFACE TECHNIQUE 51 Drawbacks • Highly coupled classes

    are not moved • Compile modules vs instant app modules • Boilerplate per module
  20. Techniques - IN SUMMARY 52 • Dependency Graph • Cycles

    Detection & Removal • IDE Support • Regression Prevention • Interface Technique