How lumec/mercadolibrechallenge works
Project Type & Purpose
• It’s a modular Android application with a clean architecture implementation.
• The app provides a search view (with Jetpack Compose) for product listings and a detailed view for selected items.
• It incorporates MVVM, dependency injection (via Hilt), Retrofit for network calls, and remote logging (Timber + Firebase Crashlytics).
Main Components
a. UI/Presentation Layer:
• The “app” module, primarily handling UI views, navigation, and composable elements.
• Within “app”, distinguish components like MainActivity, view models, composable screens (for product list and product details) and navigation setups.
b. Domain Layer:
• The “domain” module, containing business entities (e.g., ProductDetails, ProductPreview) and error handling.
• This is the core part that remains independent of external frameworks.
c. Use Cases/Interactors:
• The “usecases” module which includes use cases like GetProductsUseCase and GetProductDetailsUseCase.
• Represents the application’s business logic, serving as the mediator between the presentation and data layers.
d. Data Layer:
• The “data” module, which handles network/API data sources (e.g., ProductRemoteDataSource) and repository implementations.
e. Supporting Components:
• buildSrc: Contains dependency management and build scripts.
• testShared: Provides shared testing utilities used across unit, integration, and UI tests.
• External services/libraries (Firebase Crashlytics, Timber for logging, and libraries for asynchronous processing like coroutines).
Relationships & Interactions
• The UI Layer (app module) communicates with the Use Cases layer. These interactions follow MVVM patterns using view models.
• The Use Cases layer interacts with the Domain layer (to manipulate business entities) and with the Data layer (via repositories) to fetch or update data.
• The Data layer acts as an interface to external services (remote API, image loading via Coil).
• Dependency injection (Hilt) underpins connections between modules, ensuring loose coupling.
• Testing modules (testShared, along with unit and UI tests present in each module’s test directories) are integrated across these layers.
• External libraries and services plug into appropriate components: Retrofit in data, Firebase Crashlytics and Timber in app initialization.
Architectural Patterns & Design Principles
• Clean Architecture: Emphasize separation of concerns (presentation, domain, data).
• MVVM: Highlight unidirectional data flow from view models to UI.
• Dependency Injection: Use Hilt to inject dependencies across modules.
• Unit & Instrumentation Testing: Tapping into testShared for shared test utilities across layers.
Additional Notes
• On test layers: an auxiliary note on how the testShared module supports end-to-end (unit, integration, UI) testing.