Mobile Development 47 min read

Why Mobile App Architecture Matters: Lessons from Real-World Projects

This article explores the concept of software architecture for mobile apps, sharing personal reflections, industry case studies, design principles, modularization strategies, development practices, testing, risk management, and agile processes to help developers build maintainable, scalable, and high‑quality applications.

21CTO
21CTO
21CTO
Why Mobile App Architecture Matters: Lessons from Real-World Projects

Preface

Architecture design is a consensus built on product and technology. The author, not a professional architect, aims to summarize recent learning, discuss mobile app architecture, and encourage developers to develop architectural awareness.

1. Emergence

Initially, architecture seemed mysterious. After several projects and refactoring experiences, the author realized that simple refactoring is insufficient; true architecture requires planning and design to guide development.

2. First Encounter with Architecture

1. Reading "The Beauty of Architecture" – Chapter on Architecture

Key insights include:

Architecture is a trade‑off between quality and cost.

Architects focus on meeting requirements and quality, not just features.

Design should separate concerns and provide structures to solve specific problems.

A good architecture should be comfortable for product, development, and testing teams.

Design only what is needed; excess design is waste.

Architecture influences the health of the entire system.

2. Analyzing Industry App Architecture Evolution

Reasons for evolution:

Requirement expansion.

Team growth and higher collaboration demands.

New technology adoption.

Higher quality requirements.

Examples:

Ele.me: module decoupling, shared components, Hybrid framework, React‑Native & Hot Patch.

Ctrip: structural adjustments, SDK‑based common components, performance monitoring, native plug‑in & HotFix.

Nuomi: componentization, unified service entry, Hybrid optimization.

Suning: layered decoupling, protocol/URL mediation, H5 container optimization, network link optimization, performance monitoring.

Benefits observed:

Modular decoupling improves flexibility and teamwork.

Unified standards clarify organization and health.

New frameworks enhance user experience.

System optimization raises quality and experience.

3. Google Search Keywords: Architecture Design

Reading blogs such as Keegan Lee’s "Architecture Thoughts" deepened understanding of architecture planning, design, and construction.

3. Definition of Architecture

Two perspectives:

Composition view: architecture = components + interactions.

Decision view: architecture = set of important decisions.

For mobile apps, architecture is a consensus between product and technology.

4. Product

Developers must understand product design, anticipate trends, and align technical decisions with product goals.

1. Product Design (What to Build)

Consider user groups and core ideas to ensure the product solves real problems.

2. Iteration Plan (How to Build)

Use agile backlog and collaborative planning between product and development.

3. Development Resources (What to Use)

Team composition (product, interaction, UI, software, test) and data considerations (private vs. user‑generated).

4. Product Quality

Evaluate via user experience, software performance (startup speed, memory, power, traffic, APK size), and security (code obfuscation, data encryption, permission control).

5. Risk Mitigation

Human resource turnover.

Upper‑level decision changes.

Project delays.

Software defects.

Human errors (e.g., wrong APK release).

6. Product Delivery

Test builds released frequently.

Gray‑release strategy for large user bases.

Version management with clear naming conventions.

5. Technology

1. Technical Selection

Android is the primary platform; choose Android Studio & Gradle, Git, Maven, CI tools (Jenkins, Travis CI, etc.).

2. Development Language

Java, Kotlin, Groovy, SQL, etc.

3. Development Model

MVC, MVP, MVVM, Clean Architecture, each with pros and cons.

4. Open‑Source Frameworks

Network: OkHttp, Volley, Retrofit.

Event Bus: Otto, EventBus.

DI: Dagger, RoboGuice, ButterKnife.

Image: Fresco, Glide, Picasso.

Database: GreenDao, Ormlite, LitePal.

JSON: Gson, Jackson, FastJson.

Reactive: RxJava, RxAndroid.

Crash: Bugly, Crashlytics.

Performance: BlockCanary, LeakCanary.

5. Emerging Technologies

Android Support: DataBinding, MaterialDesign.

Hybrid: ReactNative, Weex.

Languages: Java 8, Kotlin.

HotFix: AndFix, Tinker.

Build: InstantRun, Freeline.

2. Business Splitting

Three categories:

Common basic business (shared SDKs, e.g., file upload, network).

General technical business (core tech like image processing, OCR).

Specific functional business (unique features of the app).

3. Architecture Design (Concern Separation, Abstraction)

Core Concepts

Concern separation.

Abstraction (design interfaces before implementation).

Design Thinking

Procedural, Object‑Oriented, Aspect‑Oriented, Service‑Oriented.

Design Principles

High cohesion.

Low coupling.

Appropriate design (avoid over‑design).

Design Scheme

Guiding model with horizontal block division, vertical layer division, and interface communication.

Horizontal block division: split by business function.
Vertical layer division: presentation, business, data layers.
Interface communication: modules interact via interfaces, not concrete instances.

4. Development Implementation

Project Packaging

Package by function (common, function, module) and by component (activity, fragment, util) depending on project size.

+ app
    +main
        +com.jfg
            +common   // basic business
                +util
                +widget
                +base
            +function // general technical business
                +camera
                +sensor
            +module   // specific functional business
                +moduleA
                    +model
                    +presenter
                    +view
                +moduleB
                    +model
                    +presenter
                    +view
                +moduleC
            +demo    // main program
                +app
                +activity

Abstract Interfaces

Define interfaces first; each interface should do one thing and be self‑describing.

Data Storage

SQLite, SharedPreferences, files; consider extensibility and security.

Performance Management

Mindful use of memory, CPU, GPU; release resources promptly.

Special Handling

Functional conflicts (internal and external).

Extreme operations (stress testing, resource exhaustion).

Network issues (weak signal, switching, timeouts).

Null handling.

Log Printing

Adopt consistent log levels (e, w, i, d) to aid debugging.

Software Refactoring

Refactor when needed to reduce technical debt; balance between small and large refactors.

Compatibility Adaptation

Handle diverse Android devices, screen sizes, OS versions; involve product designers early.

6. Software Testing

Combine manual testing with automated unit tests to improve quality.

7. Development Standards

Design Consistency

Apply consistent design patterns for similar problems.

Clear Coding

Simple structure, clear logic, avoid over‑use of patterns, follow SOLID principles.

Effective Documentation

Document core issues, use git commits, tags, diagrams, and keep docs concise.

8. Daily Work

Routine tasks include bug fixing, exception handling, monkey testing, performance tuning, and code quality improvement.

9. Development Drivers

TDD – Test‑Driven Development.

BDD – Behavior‑Driven Development (agile).

10. Agile Development

Emphasizes continuous communication, iterative design, and rapid response to changes.

11. Consensus Building

Product, interaction, UI, development, and testing roles must share information and make joint decisions to keep architecture aligned with evolving requirements.

12. Conclusion

The author reflects that architecture is both a set of decisions and a composition of components, acknowledging current understanding is still limited and inviting deeper future study.

References

Keegan Lee’s architecture series.

Ele.me mobile app architecture evolution.

Ctrip mobile app architecture optimization.

Nuomi component architecture evolution.

Suning mobile architecture practice.

Android app overall architecture thoughts.

Common Android frameworks discussion.

Tmall mobile decoupling case.

Agile software development explanation.

From MVC to MVP – refactoring experiences.

"The Beauty of Architecture".

"Software Architecture Design".

Source: http://www.androidchina.net/8193.html
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

modularizationAndroid Developmentsoftware designagilemobile architecture
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.