This repository contains a small, production-style Android application used as part of a senior Android developer interview.
The codebase is intentionally incomplete in one area related to data freshness and caching. Your task is to identify the issue, reason about an appropriate solution, and implement it in a clean, testable way.
The app allows users to:
- Search GitHub repositories
- View repository details
- Star and unstar repositories locally
- Continue using the app when offline via cached data
The project follows modern Android best practices, including:
- Jetpack Compose
- MVVM architecture
- Repository pattern
- Room for local persistence
- Retrofit for networking
The app relies on cached data to improve performance and support offline usage.
At the moment, the cache behaves in a naive way and does not sufficiently account for data freshness.
As a result:
- Users may see outdated information
- Network requests may happen too often or not often enough
- The behavior is inconsistent under real-world conditions (offline, retries, refreshes)
Your goal is to improve this behavior so that the app handles cached data responsibly.
We are primarily interested in:
- Your reasoning around cache invalidation and data freshness
- How you structure logic inside the existing architecture
- Your approach to testing and validation
- Code clarity, naming, and maintainability
There is no single correct implementation. If tradeoffs exist, feel free to document or explain them.
- Do not add new libraries
- Do not redesign the overall architecture
- Keep changes focused and incremental
You are free to:
- Modify repository-layer logic
- Add or update unit tests
- Introduce small helper abstractions if they improve clarity or testability
You should avoid:
- Large refactors unrelated to the problem
- UI changes that are not required for data correctness
- Open the project in Android Studio
- Explore the data flow from UI → ViewModel → Repository
- Create your own git branch
- Identify where cache decisions are made
- Implement your solution
- Validate it with tests
- Create a pull request to merge your changes into the main branch
If anything is unclear, ask questions and explain your assumptions.
The exercise is complete when:
- Cache behavior is predictable and consistent
- Data freshness is handled intentionally
- Tests reflect and validate the chosen behavior
- You can clearly explain your decisions
- If using AI tools or coding agents, document your prompts and explain your thought process in using those tools.
Good luck!