🌍 Mobile App Development · subject
Mobile App Development Architecture and Quality Syllabus
The Architecture and Quality syllabus for Mobile App Development in full: 4 chapters and 16 topics, every one listed below, plus 57 Architecture and Quality flashcards with answers.
Architecture and Quality syllabus: all 4 chapters
Expand any chapter to see its topics and sub-topics.
-
Architectural Patterns
4 topics- MVC, MVP, and MVVM
- MVI and Unidirectional Data Flow
- Clean Architecture
- Dependency Injection
-
Testing
4 topics- Unit Testing
- UI and Integration Testing
- Widget and Component Testing
- Test-Driven Development
-
Performance Optimization
4 topics- Profiling and Memory Management
- Rendering and Frame Rates
- App Startup and Battery Usage
- Network and Image Optimization
-
Security Best Practices
4 topics- Secure Data Storage
- Network Security and SSL Pinning
- Code Obfuscation and Tampering
- OWASP Mobile Top 10
Mobile App Development Architecture and Quality flashcards — 57 questions with answers
In the MVC pattern, what are the three components and their primary responsibilities?
Model (holds data and business logic), View (renders the UI), and Controller (handles user input, updates the Model and selects the View). The Controller mediates between View and Model.
How does MVP differ from MVC in terms of the View-logic relationship?
In MVP the Presenter fully handles presentation logic and the View is passive, communicating only through an interface. Unlike MVC, the View never talks directly to the Model; all interaction goes through the Presenter (typically a 1:1 View-Presenter relationship).
In MVVM, what binds the View to the ViewModel and what does the ViewModel expose?
Data binding (often two-way) connects them. The ViewModel exposes observable state/streams and commands; it has no reference to the View, so the View passively reflects ViewModel state.
Compare the coupling of the presentation layer to the View across MVC, MVP, and MVVM.
MVC Controller may hold a View reference (moderate coupling); MVP Presenter references the View via an interface (testable, decoupled from framework); MVVM ViewModel has no View reference at all (loosest coupling, driven by data binding).
Which of MVC/MVP/MVVM is generally easiest to unit test and why?
MVP and MVVM are both highly testable. MVVM is often favored because the ViewModel has no View reference and exposes plain observable state, so it can be tested with no UI or mocking of the View.
What are the four components of the MVI (Model-View-Intent) pattern?
Intent (user actions/events), Model (a single immutable state), View (renders the state), and a reducer/processor that maps Intent + current State to a new State. State flows in one direction.
Define Unidirectional Data Flow (UDF).
An architecture where state flows in a single direction: events/intents go up to a state holder, which produces a new immutable state that flows down to the UI. There is one source of truth and no two-way binding loops.
In MVI, why is the state typically immutable and singular?
A single immutable state object guarantees a predictable, reproducible UI (state is a pure function of past intents), eliminates inconsistent partial updates, and makes debugging, time-travel and testing straightforward.
What is a reducer in a unidirectional data flow architecture?
A pure function with the signature $newState = reduce(currentState, action)$ that takes the current state and an action/intent and returns the next state without side effects.
State the Dependency Rule of Clean Architecture.
Source-code dependencies must point only inward, toward higher-level policies. Inner layers (entities, use cases) know nothing about outer layers (frameworks, UI, DB); dependencies always cross boundaries pointing inward.
List the concentric layers of Clean Architecture from innermost to outermost.
Entities (enterprise business rules) -> Use Cases/Interactors (application business rules) -> Interface Adapters (presenters, controllers, gateways) -> Frameworks & Drivers (UI, DB, web, devices).
How does Clean Architecture keep inner layers independent of outer frameworks?
Through dependency inversion: inner layers define interfaces (ports) that outer layers implement. At runtime dependencies are injected inward, but at compile time the arrows point inward, so business logic never depends on frameworks.
What is a Use Case (Interactor) in Clean Architecture?
A class encapsulating a single application-specific business rule/action (e.g., 'Login user'). It orchestrates entities and calls outward through repository interfaces, remaining independent of UI and data sources.
Define Dependency Injection.
A design technique in which an object receives (is 'injected' with) its dependencies from an external source rather than creating them itself, decoupling construction from use and enabling substitution/testing.
Name the three common forms of Dependency Injection.
Constructor injection (dependencies passed via the constructor), setter/property injection (via a setter method or property), and method/interface injection (passed as a method parameter).
How does the Dependency Inversion Principle relate to Dependency Injection?
DIP is the principle: high-level modules depend on abstractions, not concretions. DI is a technique that realizes DIP by supplying the concrete implementation of an abstraction from outside the dependent class.
What is an IoC (Inversion of Control) container?
A framework that manages object creation, lifetime/scope, and dependency resolution automatically, wiring dependencies into objects so developers do not manually construct the object graph.
What is a unit test?
An automated test that verifies the smallest testable piece of code (a single unit/function/class) in isolation from its dependencies, which are replaced by test doubles, to confirm it behaves correctly.
Explain the AAA pattern used to structure a unit test.
Arrange (set up objects, inputs and mocks), Act (invoke the method under test), Assert (verify the outcome matches the expected result). It keeps tests readable and focused.
Distinguish a mock, a stub, and a fake as test doubles.
Stub returns canned responses to calls; Mock is pre-programmed with expectations and verifies interactions (behavior verification); Fake is a lightweight working implementation (e.g., in-memory DB) unsuitable for production.
Show the other 37 Architecture and Quality flashcards
What distinguishes UI tests from integration tests?
Integration tests verify that multiple modules/components work correctly together (e.g., repository + database). UI tests drive the actual user interface, simulating taps/gestures and asserting on-screen results, often end-to-end.
Where do UI (end-to-end) tests sit on the test pyramid and why are they used sparingly?
At the top (few tests). They are slow, brittle and expensive to maintain because they exercise the full stack and real UI, so only critical user journeys are covered while most logic is tested by unit tests at the base.
Describe the classic test pyramid proportions.
A broad base of many fast unit tests, a middle layer of fewer integration tests, and a small top of end-to-end/UI tests. Roughly guided as many unit, some integration, few E2E.
What is widget (component) testing in a UI framework like Flutter?
Testing a single widget/component in isolation by building it in a test environment, pumping frames, interacting with it, and asserting its rendered output and behavior without launching the full app or a real device.
How does widget/component testing differ from full integration testing in scope and speed?
Widget tests run a single component in a test harness (fast, no real device/backend), while integration tests run the assembled app on a device/emulator exercising real interactions across components (slower, more realistic).
State the three phases of the Test-Driven Development cycle.
Red (write a failing test for desired behavior), Green (write the minimal code to make it pass), Refactor (clean up the code while keeping tests green). Repeat this short cycle.
What is the core principle of TDD regarding when tests are written?
Tests are written before the production code. You only write production code to make a failing test pass, ensuring every line is driven by a requirement expressed as a test.
Name two benefits and one risk of practicing TDD.
Benefits: comprehensive regression safety net and better, more testable/decoupled design. Risk: can be slow or lead to over-testing/brittle tests if tests are coupled to implementation details rather than behavior.
What is profiling in the context of app performance?
Measuring an app's runtime resource usage (CPU, memory, GPU, network, frame timing) to identify bottlenecks and hotspots, using tools/profilers, so optimization effort targets the actual costly code paths.
What is a memory leak and a common cause on mobile?
A memory leak is memory that is allocated but never released because references are unintentionally retained. Common causes: static/global references to Activities/Contexts, unremoved listeners, or lingering closures/observers.
Differentiate the stack and the heap in memory management.
The stack stores local variables and call frames with fast, automatic LIFO allocation/deallocation; the heap stores dynamically allocated objects with longer lifetimes, managed by the allocator or garbage collector.
What is garbage collection and one performance concern it introduces?
Automatic reclamation of heap memory no longer referenced. Concern: GC pauses (stop-the-world) can cause jank/dropped frames, so minimizing allocations in hot paths reduces GC pressure.
What frame rate targets correspond to 60 fps and 120 fps, expressed as per-frame budgets?
For 60 fps the budget is $\frac{1000\ \text{ms}}{60} \approx 16.67\ \text{ms}$ per frame; for 120 fps it is $\frac{1000}{120} \approx 8.33\ \text{ms}$ per frame.
Define 'jank' and how it relates to the frame budget.
Jank is a visible stutter caused when a frame takes longer than the frame budget (e.g., $>16.67\ \text{ms}$ at 60 fps) to build and render, so the frame is dropped/late and animation appears to skip.
Give the formula relating frame rate to frame time.
$$\text{FPS} = \frac{1}{\text{frame time (s)}} = \frac{1000\ \text{ms}}{\text{frame time (ms)}}$$ Frame rate is the reciprocal of the time to produce one frame.
What are the two GPU/CPU-side phases that must both fit in the frame budget for smooth rendering?
The UI/CPU phase (building and laying out the frame, e.g., widget build + layout + paint recording) and the GPU/raster phase (rasterizing and compositing). Both must complete within the frame budget.
Distinguish cold, warm, and hot app startup.
Cold start: process is not running and must be created from scratch (slowest). Warm start: process exists but the activity/UI must be recreated. Hot start: the app is fully in memory and only brought to foreground (fastest).
Name two common techniques to reduce cold-start time.
Defer/lazy-initialize non-critical work off the startup path (lazy loading, background threads), and minimize main-thread work before first frame (e.g., avoid heavy synchronous I/O, use a lightweight splash and app-startup libraries).
List three major contributors to mobile battery drain from an app.
Frequent network/radio wakeups (especially cellular), excessive CPU/GPU work (animations, polling), and wake locks / GPS and sensor usage that keep components powered. Background work and bright screen usage also contribute.
What batching strategy reduces radio-related battery drain?
Batch and defer network requests so the radio wakes up less often (coalescing transfers, using scheduled/deferred jobs like WorkManager), amortizing the radio's high-power tail state across many requests.
Name three techniques for optimizing network usage in a mobile app.
Caching responses to avoid repeat requests, compressing payloads (gzip) and using efficient formats (Protobuf/JSON minimization), and batching/paginating requests plus using HTTP conditional requests (ETag/If-Modified-Since).
List four common image optimization techniques for mobile apps.
Downsampling/resizing to the display size, using efficient formats (WebP/AVIF), memory + disk caching, and lazy loading with placeholders. Serving appropriately sized images from the server also reduces bandwidth and memory.
Why is decoding an image to its display resolution important for memory?
An uncompressed bitmap uses roughly $width \times height \times 4$ bytes (ARGB_8888). Decoding a large image at full resolution wastes memory and risks OOM, so downsampling to the target view size drastically cuts memory usage.
What is the recommended approach for storing small sensitive values like tokens on mobile?
Use the platform secure storage backed by hardware: iOS Keychain and Android Keystore/EncryptedSharedPreferences. Never store secrets in plain SharedPreferences/UserDefaults, plaintext files, or hard-coded in code.
Contrast symmetric and asymmetric encryption for secure data storage.
Symmetric encryption uses one shared secret key for both encrypt and decrypt (fast, e.g., AES); asymmetric uses a public/private key pair (slower, e.g., RSA/ECC). Local data-at-rest is typically encrypted with symmetric AES keys protected by the Keystore/Keychain.
What role does the hardware-backed keystore (Secure Enclave/TEE) play in secure storage?
It generates and stores cryptographic keys in isolated secure hardware so key material never leaves the secure element. Apps request crypto operations without extracting the key, protecting secrets even if the OS/app process is compromised.
What is SSL/TLS certificate pinning and what attack does it defend against?
Pinning hard-codes the expected server certificate or public-key hash in the app and rejects any other, even if signed by a trusted CA. It defends against man-in-the-middle attacks using fraudulent or CA-compromised certificates.
Differentiate certificate pinning from public-key pinning.
Certificate pinning pins the whole certificate, so rotating/renewing the cert breaks the app until updated. Public-key pinning pins only the public key (SPKI hash), which survives certificate renewal as long as the key pair is reused, giving more flexibility.
What are code obfuscation and its main purpose?
Transforming compiled code (renaming classes/methods to meaningless identifiers, removing debug info, control-flow scrambling) so it is hard to reverse-engineer, while preserving behavior. Purpose: raise the cost of understanding and tampering with the app.
What is tamper detection / anti-tampering and name one technique?
Mechanisms that detect if an app binary or runtime has been modified (repackaged, hooked, or run on a rooted/jailbroken device). Techniques: signature/checksum verification of the app package, root/jailbreak detection, and runtime integrity/attestation checks.
According to OWASP, roughly what does the Mobile Top 10 represent?
A prioritized list of the ten most critical mobile application security risks, published by OWASP to guide developers on the most common and impactful mobile vulnerabilities to mitigate.
Name the OWASP Mobile Top 10 (2024) risk that replaced 'M1: Improper Platform Usage' at the top of the list.
M1: Improper Credential Usage (the 2024 list leads with improper credential usage and M2: Inadequate Supply Chain Security), reflecting a shift toward credential and supply-chain risks.
List four representative categories from the OWASP Mobile Top 10.
Improper Credential Usage, Insecure Data Storage, Insecure Communication, and Insufficient Cryptography. Others include Inadequate Supply Chain Security, Insecure Authentication/Authorization, and Insufficient Binary Protections.
Which OWASP Mobile risk covers hard-coded secrets and misuse of API keys, and how is it mitigated?
Improper Credential Usage / Insufficient Cryptography. Mitigation: never hard-code credentials in the binary, store secrets in secure hardware-backed storage, use short-lived tokens, and fetch/rotate keys via a secure backend.
What OWASP category does 'Insecure Communication' address and its core mitigation?
It addresses transmitting data over unencrypted or weakly protected channels. Core mitigation: enforce TLS for all traffic, validate certificates, apply certificate/public-key pinning, and never accept invalid or self-signed certs in production.
How does 'Insufficient Binary Protections' in OWASP relate to obfuscation and anti-tampering?
It flags apps that lack defenses against reverse engineering and code modification. Mitigations are exactly obfuscation, anti-debugging, integrity/checksum verification, and root/jailbreak detection to protect the binary.
Why is testable architecture (MVP/MVVM/Clean) a prerequisite for effective unit testing?
By separating business logic from UI/framework code and depending on abstractions (injected dependencies), these architectures let logic be exercised in isolation with test doubles, avoiding slow, brittle device-dependent tests.
Mobile App Development Architecture and Quality FAQ
What is in the Mobile App Development Architecture and Quality syllabus?
Mobile App Development Architecture and Quality is split into 4 chapters: Architectural Patterns, Testing, Performance Optimization and Security Best Practices. Together they contain 16 topics.
How many chapters are in Mobile App Development Architecture and Quality?
4 chapters, containing 16 topics. The largest chapter is Architectural Patterns, with 4 topics.
Are there flashcards for Mobile App Development Architecture and Quality?
Yes — a 57-card Architecture and Quality deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.