mitch
02/07/2024, 10:36 PMDaniel Ciocirlan
02/08/2024, 7:15 AMDaniel Ciocirlan
02/08/2024, 7:18 AMsimon.vergauwen
02/08/2024, 8:33 AMsindrenm
02/08/2024, 9:00 AMsimon.vergauwen
02/08/2024, 9:03 AMsindrenm
02/08/2024, 9:04 AMcarbaj0
02/08/2024, 9:19 AMdave08
02/08/2024, 4:11 PMRiccardo Cardin
02/08/2024, 8:20 PMRiccardo Cardin
02/08/2024, 8:21 PMmitch
02/08/2024, 10:07 PMValidate<T>
instance which allows us to plug-in validatorsdave08
02/11/2024, 10:49 AMrespond
at the end of that file... it goes to show how that logic still needs a big when on the business layer... the validation errors that might only be related to one particular use case has to be added to that respond function, and each change in use cases need to alter it.
I have another sealed interface for response types that are a bit more like the http layer and in each use case I translate the error from the data layer to what's expected in the http layer, that way the http layer doesn't depend on any use case errors, but the downside is that business logic now has to understand some kind of meta-http response type... I'm not sure how to make any of this any better though...Riccardo Cardin
02/11/2024, 10:57 AMdave08
02/11/2024, 10:58 AMRiccardo Cardin
02/11/2024, 10:59 AMdave08
02/11/2024, 11:03 AMdave08
02/11/2024, 11:05 AMprocess
function required a Validator parameter... making sure you pass one not matter which event you're running, here in Ktor an endpoint doesn't force you to use a validator... if you wouldn't validate but just call.recieve() the compiler wouldn't complain... which is another point in the video that you want the compiler to force you to validate things...Riccardo Cardin
02/11/2024, 12:03 PMprocess
function in real-life scenarios. You always have a stack of application/business/persistence logic for each model/scenario. If you try to have something more abstract, you'll couple things that should not relate to each other.
The article/video aims to show how to achieve polymorphism without subtyping.Riccardo Cardin
02/11/2024, 12:04 PMdave08
02/11/2024, 12:12 PMRiccardo Cardin
02/11/2024, 12:22 PMRiccardo Cardin
02/11/2024, 12:26 PMdave08
02/11/2024, 12:28 PMRiccardo Cardin
02/11/2024, 12:29 PMRiccardo Cardin
02/11/2024, 12:29 PMdave08
02/11/2024, 12:31 PMMaybe, there are other use cases that show better the separation of concernsProbably, thanks for the idea itself 😃, at least when I see such a case, I'll have this technique up my sleeve!