-
Notifications
You must be signed in to change notification settings - Fork 4
Architectural alignment #48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
implementations in to the journey and to not make use of a domain model anymore
| companion object { | ||
| const val ACCOUNT_NAME = "Alpha" | ||
| const val ACCOUNT_BALANCE = "45.89" | ||
| val ACCOUNT_BALANCE = BigDecimal.valueOf(45.89) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has potential precision and unchecked nullability issues. Better to use BigDecimal("45.89") to be exact.
| import com.backbase.android.client.gen2.arrangementclient2.model.AccountArrangementItem | ||
| import dev.drewhamilton.poko.Poko | ||
|
|
||
| interface AccountDetailUseCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| interface AccountDetailUseCase { | |
| fun interface GetAccountDetailUseCase { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend this change to enforce the SAM nature of this use-case and name it accordingly.
|
|
||
| interface AccountDetailUseCase { | ||
| suspend fun getAccountDetail(params: Params): Result<AccountDetail> | ||
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> | |
| suspend operator fun invoke(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
operator is also a nice addition here to allow:
val getAccountDetails = GetAccountDetailUseCase { params ->
...
}
getAccountDetails(Params{})
| * @return an instance of [ProductSummary] | ||
| */ | ||
| suspend fun getAccountSummary(useCache: Boolean = true): Result<AccountSummary> | ||
| suspend fun getAccountSummary(useCache: Boolean = true): Result<ProductSummary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| suspend fun getAccountSummary(useCache: Boolean = true): Result<ProductSummary> | |
| suspend operator fun invoke(useCache: Boolean = true): Result<ProductSummary> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same recommendations as AccountDetailUseCase
|
|
||
| interface AccountDetailUseCase { | ||
| suspend fun getAccountDetail(params: Params): Result<AccountDetail> | ||
| suspend fun getAccountDetail(params: Params): Result<AccountArrangementItem> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am still not convinced about exposing client objects directly with the journey's APIs. We risk unnecessarily coupling the client API with journey's API. Clients are generated and inherently produce unstable(especially from past experience) API that strongly tied to the BE. I am not sure it's prudent to strongly couple the 2.
Also keep in mind that for certain BE capabilities, their models don't map 1-to-1 to UI models . BE models will still need some mapping/transformation in the journey in some cases.
Architectural alignment journey