Joy ZhaoHire Me
Modern Android Architecture
androidlive

Modern Android Architecture

Lego Architecture

Flagship demo of Lego Architecture — divide and conquer taken to the extreme

FlagshipLego ArchitectureModularizationDesign PatternsBlog Series

Problem

Complex Android UIs become unmaintainable monoliths. Teams struggle to reuse components, enforce consistency, and refactor product detail pages without cascading changes across the codebase.

Solution

Designed and implemented the Lego Architecture pattern — infinite splitting until the smallest particle. A multi-module demo with 8 feature modules, List Item Assembler, Data Mapper, ViewType management, and a 4-part architecture blog series published on DEV.

Architecture

Multi-module Gradle project — app, app_res (shared resources), common (base classes & widgets), 8 feature modules (goods, home, login, bill, order, shop, social), tools, and utilities. Product detail page refactored from 3,000 lines to 15 standalone Lego components using Observer, Template Method, and Simple Factory patterns.

Tech Stack

Kotlin · MVVM · Modularization · RecyclerView · ViewModel · Design Patterns · Gradle Multi-Module

Challenges

• Refactoring a product detail page from 3,000 lines to 15 standalone Lego components • Three-layer color system and drawable layer conventions for visual consistency • Dynamic RecyclerView assembly with multiple view types without God adapters

Result

Open-source flagship project with product detail screenshot, 11 modules, and a 4-part DEV blog series documenting a decade of Android architecture evolution.

Representative work as a Senior Android Architect — this is the project that defines how I think about Android system design.

The architecture follows the Lego Architecture principle — infinite splitting until the smallest particle:

  • Divide and Conquer — Breaking complex UI into minimal, independent components
  • Single Responsibility — Each component has one clear purpose
  • Reusability — Building blocks that can be reused across the app
  • Maintainability — Clean separation of concerns

Core Modules

ModuleDescription
appApplication entry point
app_resShared resources (colors, styles, drawables)
commonCommon utilities, base classes, widgets
feature-goodsProduct detail page implementation
feature-homeHome page with bottom navigation
feature-loginLogin feature
feature-billBill rendering feature
feature-orderOrder feature
feature-shopShop feature
feature-socialSocial feature
toolsUtility classes

Key Concepts

  1. List Item Assembler — Dynamically builds RecyclerView items
  2. Data Mapper — Converts raw data to UI state
  3. ViewType Management — Multiple view types for complex UI
  4. ViewModel — Manages data loading and state conversion
  5. Design Patterns — Observer, Template Method, Simple Factory

Blog Series

This project is accompanied by a 4-part blog series:

  1. Part 1: A Decade of Android Architecture Evolution: What Problem Are We Really Solving?
  2. Part 2: The Lego Architecture: Divide and Conquer, Taken to the Extreme
  3. Part 3: Refactoring a Product Detail Page with Lego Architecture: From 3000 Lines to 15 Standalone Components
  4. Part 4: Design Patterns — The Glue of Lego Architecture

Note: Chinese versions of all articles are available in the docs/ folder.