m

    Mike

    2 years ago
    Read the "Domain Modeling Made Functional" book, but did the code examples in Kotlin (and Arrow-kt where appropriate). I've published the repo at https://gitlab.com/mikezx6r/domain-functional. For the
    Result
    , I've used
    Either
    as
    BIO
    isn't quite available.
    BIO
    appears close, so I may use the 0.11.0-SNAPSHOT of Arrow, and add a version using that. Regardless, if you have any comments, feedback, or questions on the code, please let me know. Certainly increases my desire to use a strictly typed domain for writing code. You'd still want tests (of which I only have a few in this repo), but it simplifies testing. Mocking becomes providing a Lambda that conforms to the signature and returns the value you want. No complicated (and slow) mocking frameworks. Simple DI in the real code, explicit business case error vs exceptional situation separation. I see many benefits to this approach.
    t

    trathschlag

    2 years ago
    I never should have read that book. It made me quite jealous of certain F# features 😦
    m

    Mike

    2 years ago
    I'm curious. Which features in particular? I've been able to implement the concepts in the book using Kotlin, and Arrow-kt quite cleanly, so I'm wondering what I missed.
    t

    trathschlag

    2 years ago
    Mostly really nice pattern matching. Also designing with types in Kotlin still needs a lot more boilerplate, even with data classes.
    m

    Mike

    2 years ago
    Agree on pattern matching, but as I've never really worked with a language that supported it, don't really notice. And it's coming to Java, so it should filter to Kotlin... Of course still a few years away. Hmm, yes, a bit more boilerplate, but I was surprised how close the Kotlin code is to the F# code.
    I think Scala is closer to F# for those features, but I suspect you're as likely to be able to adopt Scala as F# 😉