The fundamentals of Funtional Programming with Kotlin

By abhay sood

Elevator Pitch

I was introduced to functional programming by a colleague. I’ve been reading about it’s concepts and have tried to apply them in my day to day development. The result of which I’ve found the code I write a lot more cleaner, safer and bug free. I hope to share this knowledge by means of this talk.

Description

Kotlin supports functions as first class citizens. This is arguably the most important feature of Kotlin. It opens up a whole new style of programming - Functional Programming (FP). Kotlin seems to provide a great balance between OOP and FP. Making it a great language to slowly learn the concepts of FP without having to go through the huge learning curve all at once.

The goal of this talk is to help you understand the concepts behind functional programming, help to change the way you think, and thereby help you in becoming a better developer. We’ll also go through a few real world examples in Kotlin where thinking functionally can help you in writing cleaner, safer and reusable code.

You surely won’t become a functional programmer after this talk but let me quote from the famous essay why why functional programming matters matters:

“…it(FP) expresses an opinion about what makes programs better. It backs this opinion up with reasons why modern functional programming languages are more powerful than imperative programming languages. But even if you don’t plan to try functional programming tomorrow, the lessons about better programs are valuable for your work in any language today.”

Notes

I am an Android developer at Go-Jek. For the past 1.5 years I have been working on Kotlin and am one of the developers who started introducing Kotlin to the Android codebase at Go-Jek. We have 97% Kotlin code in one of our major products which we rewrote from scratch last year. I wrote about that here: https://blog.gojekengineering.com/an-architectural-overview-of-the-new-go-jek-rider-app-bb1dbd174323.

I’ve also presented on a similar topic at JetBrains Night, Bangalore on 27th April, 2018. Here are the slides for that talk. https://speakerdeck.com/abhaysood/thinking-functionally-in-kotlin-jetbrains-night-bangalore