I'm creating a new backend API server in Kotlin an...
# functional
e
I'm creating a new backend API server in Kotlin and I was wondering what best practices users here recommend around using Arrow and Kotlin.Result. What features, if any, of Arrow do you find indispensable and why, taking into consideration the fact that new programmers may not be familiar with functional programming or even Kotlin, and just Java instead? Which ones would you introduce first? As you might suspect, I'm thinking of Kotlin.Result or Arrow.Either.
k
If your aim is just to avoid using try-catch, I wouldn't advise bringing in a whole library like Arrow just for that. It will steepen the learning curve especially for those coming from Java with no experience of functional programming. If you want to use Arrow because you want to use a functional style throughout, that's another matter. Also, I wouldn't use kotlin.Result as a replacement for try-catch. The problem is that it catches everything, including Throwables that you shouldn't catch, such as Error and CancellationException.
t
https://vimeo.com/748031479 I had a talk about this problem 🙂 that might help a bit in introducing stuff. It is a bit dated now though, since arrow has evolved by now 🙂 but it can still be a good start
mind blown 1
Feel free to send me a message with any questions 🙂
k
Take a look at using Railway Oriented Programming. Understanding this will leap you forwards in understanding the idioms around how you should be using Either
t
yes 🙂 anything from scott is amazing 🙂 https://fsharpforfunandprofit.com/video/
e
Thank you for sharing the links; I will check them out. But I should point out that I'm not new to functional programming. I am approaching the problem from an engineering leadership point of view; would adopting any of these libraries help the organization? Will they confer near- and long-term benefits given the need for engineers to ramp up on them? What have you observed in your organizations, and what level of familiarity with functional programming did your members have going in?