Rules Hub
Coding Rules Library
← Back to all rules
Rule priority, scope & exceptions
Use this to align rules with the senior-level structure (P0/P1/P2, scope, exceptions/tradeoffs).
mobile ruleP1universalStack: mobile
mobilearchitecturerepository
Access data through a repository, not directly from the UI
Route network/DB access through a repository so caching, offline and error handling live in one place and the UI stays thin.
PR: mobile-canon-2026-06Created: Jul 5, 2026
Bad example
Old codekotlin
| 1 | // Fragment calls Retrofit service directly |
Explanation (EN)
Objašnjenje (HR)
Good example
New codekotlin
| 1 | // Fragment -> ViewModel -> Repository -> (network/cache) |
Explanation (EN)
Objašnjenje (HR)