-
Notifications
You must be signed in to change notification settings - Fork 0
Implementation Plan: Domain Layer & Modular Transition Strategy
Introduce a dedicated Domain Layer and establish a modular package foundation for the Rho Studio UI application. This plan executes on the "Path to Enterprise-Grade Architecture" defined in the README.md, moving from a single-module Gradle structure toward a decoupled, multi-module architecture.
Project Description & Goal
Rho Studio UI is a modern Android application built with Jetpack Compose and MVVM following a Single-Activity Architecture.
The goal of this task is to implement a Modular Transition Strategy:
- Consolidate Business Logic: Move business rules from the
ViewModelandDatalayers into a dedicated Domain Layer. - Prepare for Multi-Module Gradle: Reorganize the current internal package structure within the
:appmodule to mirror a future multi-module setup (e.g.,:core:domain,:core:data,:feature:auth). This ensures that the eventual split into separate Gradle modules is a low-risk, structural change. - Support Reactive Navigation: Utilize the Domain Layer as the catalyst for routing. Use Cases drive session state changes in
SessionManager, whichMainActivityobserves to perform reactive Compose Navigation transitions.
Dev team review Required
Important
Internal Modularization: We will reorganize the internal core and feature packages to strictly respect the boundaries of a multi-module architecture. The domain layer will be designed to be framework-independent (pure Kotlin), making it ready for a future :core:domain module split.
Note
UDF & Navigation: ViewModels and Use Cases will not hold references to the NavController. They will only mutate state, while MainActivity remains the sole orchestrator of navigation, responding to the Domain-driven session state.
Proposed Changes
[Architectural Reorganization]
Restructure the internal packages to align with the Modular Transition Strategy.
[REORGANIZE] com.rho.studio.ui.core
- Move
repositoryandmanagerintocom.rho.studio.ui.core.data(Future:core:data). - Move
model(pure data entities likeUser) intocom.rho.studio.ui.core.domain.model(Future:core:domain). - Create
com.rho.studio.ui.core.domain.usecasefor framework-independent business logic.
[Core: Domain Layer]
Implement the "Interactors" as the new home for all business rules.
[NEW] Result.kt
- Standardized success/failure wrapper for Use Cases.
[NEW] LoginUseCase.kt
- Atomic Business Transaction:
- Validate input using the
Credentialsdomain model. - Execute authentication via the Data layer.
- Apply Domain transformations (e.g., name formatting).
- Commit the session state to the Single Source of Truth (
SessionManager).
- Validate input using the
[NEW] LogoutUseCase.kt
- Atomic termination of user session, triggering the reactive navigation flow.
[Core: Data Layer]
Refine data components to serve as the implementation detail for the Domain layer.
SessionManager.kt
- State Responsibility: Act as the Single Source of Truth for observation.
- API Evolution: Add internal
updateSession(user: User)andclearSession()methods; deprecate old business-logic-heavylogin/logoutmethods.
[Feature Integration]
Refactor UI features to depend on the Domain Layer for all actions.
MainActivity.kt
- Continues to observe the
SessionManagerstate to handle reactive navigation transitions (Login <-> Home).
LoginViewModel.kt
- Replace direct manager calls with
LoginUseCase. - Focus purely on UI state management and immediate feedback validation.
HomeViewModel.kt
- Use
LogoutUseCaseto trigger session termination.
Verification Plan
Automated Tests
- Run
./gradlew testto ensure zero regression. - NEW: Unit tests for Use Cases in
core.domain.usecaseto verify atomic business rules and identity transformations.
Manual Verification
- Reactive Navigation: Verify that successful login/logout via Use Cases correctly triggers the
MainActivitynavigation flow. - Modular Boundary Audit: Verify that no feature ViewModels directly access
SessionRepositoryor bypass the Use Case layer for state mutation. - Logcat Verification: Confirm the atomic transaction steps in
LoginUseCase.
Rho.Studio® - Engineering Department - Contact alexis.tercero@rho.studio
List view
0 of 0 selected 0 issues of 0 selected
There are no open issues in this milestone
Add issues to milestones to help organize your work for a particular release or project. Find and add issues with no milestones in this repo.