How google/iosched works
Main Components
• UI/Presentation Layer (Mobile Module):
– This is primarily the “mobile” directory which includes Activities, Fragments, Views, Data Binding, and Navigation components.
– The UI layer is responsible for rendering conference data (session lists, event details, maps, etc.), handling user interactions (starring, reserving events), and interacting via ViewModels.
• Domain Layer:
– Found largely in the “shared/domain” directory. This layer contains Use Case classes (files ending with UseCase.kt) that encapsulate discrete business logic (for example, loading announcements, filtering sessions, etc.).
– This layer acts as a bridge between the presentation/UI and the underlying data.
• Data Layer (Repository and Data Sources):
– The “shared/data” (and similar directories like “model” for plain data models) encapsulates the Repository pattern. Repositories abstract various data sources, including remote data from Firebase Firestore, remote conference data, local storage via DataStore, and Room for full text search.
– There are modules for different types of data (agenda, codelabs, sessions, preferences, user events, etc.).
• Dependency Injection:
– Injection is centralized via Hilt (DI modules are found in directories like “mobile/src/main/java/.../di” and “shared/di”). This provides loose coupling between the layers.
• External Services:
– Firebase components (Cloud Firestore, Cloud Functions, Cloud Messaging, and Remote Config) are integrated as external services.
– Additionally, the project includes benchmarking tools (the benchmark and macrobenchmark directories) and testing facilities (Espresso, JUnit, and Mockito tests under “androidTest”, “test”, “test-shared”, etc.).
Relationships & Interactions
• The UI layer (Activities/Fragments) observes state via ViewModels which in turn interact with the Domain layer.
• The Domain layer (Use Cases) coordinates data operations by calling the Repository interfaces.
• The Repository layer aggregates data from various sources (remote API calls to Firebase/Firestore, local caches via Room or DataStore) and returns data back to Use Cases.
• Dependency Injection (Hilt modules) provides the means to bind the implementations to their consumer components.
• Navigation is controlled via the Navigation component where interactions between screens are clearly defined.
• Testing modules simulate or stub out the real services (see “androidTest”, “test-shared”) to ensure each layer can be verified in isolation.
Architectural Patterns and Design Principles
• MVVM: Separation of concerns is maintained by moving logic out of Activities/Fragments into ViewModels.
• Repository Pattern: The data layer abstracts different data sources and encapsulates the logic of retrieving, caching, and updating data.
• Clean Architecture: A lightweight domain layer (Use Cases) isolates business logic from UI and data concerns.
• Dependency Injection (Hilt) ensures loose coupling and easier testing.
• Use of Kotlin Flows ensures reactive programming and efficient observation of asynchronous data.
• Modular Design: With modules such as “mobile”, “shared”, “model”, and testing directories, each module provides distinct responsibilities.
Relevant Technologies, Frameworks, and Libraries
• Languages and Build Tools: Kotlin, Gradle (Kotlin DSL)
• UI & Architecture: Android Architecture Components, ViewModel, Data Binding, Navigation Component, Jetpack Compose (experimental branch)
• Data Handling: Kotlin Flows, Room (with Fts4), Jetpack DataStore
• Dependency Injection: Hilt
• External Services: Firebase (Cloud Firestore, Cloud Messaging, Remote Config, Cloud Functions)
• Testing: Espresso, JUnit4, Mockito; Benchmarking via Jetpack Benchmark library