Bảng Điều Khiển Ôn Phỏng Vấn Android
Kotlin • MVVM • Flow • REST API • Compose • Testing
Product Catalog / Movie Explorer
Một app nhỏ nhưng đủ chứng minh năng lực modern Android: Kotlin, MVVM, Coroutines, StateFlow, REST API và Compose.
Mục tiêu: Hiển thị danh sách sản phẩm từ REST API, xem chi tiết, xử lý đầy đủ loading/success/empty/error.
Tính năng cốt lõi
Kotlin + MVVM
ViewModel giữ state, Repository lấy data.
Retrofit REST API
Gọi API thật, map DTO sang model.
Coroutines + StateFlow
Async an toàn, expose UiState.
Jetpack Compose
List + detail screen (hoặc XML).
Navigation
List → Detail, truyền id, back stack.
Loading / Empty / Error
Trạng thái rõ ràng, error có nút retry.
Làm thêm nếu còn thời gian
Search + debounce
Lọc theo từ khoá, debounce input.
Favorite (Room)
Lưu local, single source of truth.
Firebase Analytics
Log event screen_view, item_click.
Unit test ViewModel
2-3 case cho state transition.
README kiến trúc
Giải thích lựa chọn thiết kế.
Cấu trúc project
data/
remote/ // Retrofit service, DTO
model/ // DTO -> domain mapping
repository/ // ProductRepository
domain/
model/ // Product (domain model)
usecase/ // optional
ui/
screen/ // ProductListScreen, ProductDetailScreen
component/ // reusable composables
viewmodel/ // ProductViewModel
core/
network/ // OkHttp, interceptor
common/ // Result, UiStateDòng README nên viết
- Architecture
- MVVM + Repository
- Async
- Kotlin Coroutines + StateFlow
- UI
- Jetpack Compose
- Network
- Retrofit + OkHttp
- State handling
- Loading / Success / Empty / Error
- Testing
- ViewModel unit tests với fake repository
UI states
Loading
Hiển thị indicator khi đang fetch.
Success
Hiển thị danh sách sản phẩm.
Empty
Thông báo khi danh sách rỗng.
Error
Màn hình lỗi kèm nút retry.
API contract
/productsLấy danh sách sản phẩm./products/{id}Lấy chi tiết một sản phẩm.Edge cases phải xử lý
Test cases (Given / When / Then)
Spec-driven: ví dụ spec đầy đủ
Feature: Product List Screen
Goal:
Show a list of products from remote API.
Architecture:
- MVVM
- UI observes StateFlow from ViewModel
- ViewModel calls ProductRepository
- Repository calls ProductApi
UI States:
- Loading
- Success(products)
- Empty
- Error(message)
User Actions:
- Open screen -> load products
- Pull to refresh -> reload
- Tap product -> navigate to detail
Rules:
- Do not call API directly from Composable
- Handle network failure, show retry
- Use immutable UI state
- Keep Composable stateless where possible
Acceptance Criteria:
- Loading indicator appears while fetching
- Product list appears after success
- Empty message appears when list is empty
- Error screen appears when API fails
- Retry button triggers reload
Tests:
- Given repository returns data, ViewModel emits Success
- Given repository throws exception, ViewModel emits Error
- Given repository returns empty list, ViewModel emits EmptyCâu pitch khi phỏng vấn
Em có làm một project nhỏ để ôn lại modern Android. Em dùng MVVM, Repository, StateFlow, Coroutine và Compose. UI observe state từ ViewModel, ViewModel gọi Repository, Repository gọi API và map DTO sang domain model. Em cũng handle loading/error và viết unit test cho ViewModel.