tonyxrandall

tonyxrandall

How to leverage functional programming in Kotlin to write better, cleaner code

As DoorDash transitioned from Python monolith to Kotlin microservices, our engineering team was presented with a lot of opportunities to improve operational excellence and continue our obsession with reliability. While there are many ways we can improve our engineering metrics via optimized hardware and suitable system designs, one direct lever we can pull as developers to contribute to the overall engineering excellence is to write better and cleaner code on a daily basis.

And one way for developers to write cleaner code is to adopt the paradigm of functional programming (FP) using Kotlin. As a multi-paradigm general-purpose programming language, Kotlin provides a lot of the necessary toolkits we need to leverage FP in our day-to-day coding.

In this post, we are going to talk about what functional programming is, what the benefits and potential downsides of it are, how it compares to the alternative paradigm imperative programming (IP), what Kotlin provides for developers to leverage FP, and examples of how we at DoorDash write FP-style code in Kotlin.

https://doordash.engineering/2022/03/22/how-to-leverage-functional-programming-in-kotlin-to-write-better-cleaner-code/

Most Liked

andrea

andrea

I have been learning F# for the past few months now. And writing applications at work in F#, compared for C#, has really been a joy. :slight_smile:

Where Next?

Popular Backend topics Top

First poster: bot
It’s not legacy code — it’s PHP. Vimeo has been using PHP in production for over 15 years. Find out how we keep a million lines of PHP i...
New
Rainer
Just wrote a short post, more a memo to myself, but maybe someone find it useful :stuck_out_tongue: https://dwarfte.ch/2021/02/03/giving...
New
AstonJ
Just listening to this now… Totally agree with @FrancescoC’s and @thompson_si’s comment “learn to learn” :sunglasses: In our talk we’...
New
First poster: bot
Over the last few years, due in large part to the hype surrounding blockchain and cryptocurrencies, decentralized applications have gaine...
New
First poster: AstonJ
They expect you to make a onepage application (SPA) The polaris design system officially only supports react Integration with the s...
New
First poster: bot
Like, on a scale from c to rust? issue c zig (release-safe) rust (release) out-of-bounds heap read/write none runtime runtime ...
New
CommunityNews
This thread was posted by one of our members via one of our news source trackers.
New
First poster: bot
I’ve been more serious about learning Rust recently, after dragging on with passive learning for a while. My first real programming langu...
New
GoulvenClech
Hi everyone :wave: I’m excited to share an article detailing how we have reorganized our Elixir/Phoenix project’s directory structure. W...
New
mudasobwa
Peeper is the tiny library to preserve state across GenServer crashes/restarts. Works as an almost drop-in substitute for GenServer, sui...
New

Other popular topics Top

axelson
I’ve been really enjoying obsidian.md: It is very snappy (even though it is based on Electron). I love that it is all local by defaul...
New
DevotionGeo
I know that -t flag is used along with -i flag for getting an interactive shell. But I cannot digest what the man page for docker run com...
New
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
First poster: bot
Large Language Models like ChatGPT say The Darnedest Things. The Errors They MakeWhy We Need to Document Them, and What We Have Decided ...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
AstonJ
This is cool! DEEPSEEK-V3 ON M4 MAC: BLAZING FAST INFERENCE ON APPLE SILICON We just witnessed something incredible: the largest open-s...
New
Fl4m3Ph03n1x
Background Lately I am in a quest to find a good quality TTS ai generation tool to run locally in order to create audio for some videos I...
New