-
Notifications
You must be signed in to change notification settings - Fork 136
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
Should Repository be parameterised (object, id type)? #45
Comments
Thanks for your comments .. Regarding |
Right, but the algebra of the
That in turn shows up in the algebra of the
In other words, trait AccountService[Account /* this is parameterized, which is good */] {
def open(
no: String,
name: String,
rate: Option[BigDecimal],
openingDate: Option[Date],
accountType: AccountType
)(repository: { def store(a: models.Account /* here we leak the concrete Account model */): \/[NonEmptyList[String], Account] }): Valid[Account]
} EDIT: My question essentially boils down to: if we're going through the trouble of parameterising |
ah .. I get what you say. You are correct! It would certainly be better to parameterize the algebra of repository with the domain entities as type parameters. |
Currently making my way through the book in detail (awesome btw), and I realised that in Chapter 5,
AccountService
is parameterised onAccount
,Amount
, andBalance
, which is awesome, butAccountRepository
on which it depends is not; I was curious if it should be ?frdomain/src/main/scala/frdomain/ch5/domain/service/AccountService.scala
Lines 17 to 35 in 48664c3
frdomain/src/main/scala/frdomain/ch5/domain/repository/AccountRepository.scala
Lines 11 to 21 in 48664c3
In effect, doesn't this mean that
AccountService
is coupled to the concrete models due tofrdomain/src/main/scala/frdomain/ch5/domain/service/AccountService.scala
Line 18 in 48664c3
?
The text was updated successfully, but these errors were encountered: