Fight Complexity with Functional Programming
Gopal S Akshintala
This talk attempts to familiarize Function Programming (FP) and how it can improve your code quality by turning it more expressive and testable with minimum accidental complexity.
This talk discusses the design scenarios where FP fits the best and why is it the first choice for domains like Machine Learning, Reactive, Big Data etc. Let’s demystify the dreaded Monad and its application in Enterprise software. Let’s go through a demo, based on real events, on how to solve a complex design problem of building a Batch-validation framework for REST services, using Monads, that is 3D Scalable, with dimensions as - Request Batch size, Validation count and No.of Services.
- This talk has 2 stories embedded. In the first part, it explains the differences between Imperative and Declarative styles and demonstrates the Core:Context philosophy behind the declarative style, which helps in separating out How-to-do from What-to-do, using Clojure sequence.
- Then the talk transitions to the second part with a crash course on Monads and Functional Composition.
- The second part takes the Core:Context philosophy to the next level, by applying it to solve a real-world design problem, which is common across many REST services, Batch-Validation.
- The talk demonstrates, how batch validation can quickly get complex when done imperatively, mixing what-to-do(Validations), with how-to-do(Validation Orchestration) and how it can’t be scaled with any of these three dimensions - Request Batch size, Validation count and No.of Services.
- Then the talk offers a Functional Programming (FP) solution, using Monads and Lambdas, which Minimizes the accidental complexity without compromising Time complexity, and can seamlessly scale across all the dimensions.
- Throughout this talk, various types of Monads are introduced and how they fit in the context of the problem.
- This talk attempts to slowly ramp-up the audience on functional programming and towards the end, we touch upon advanced concepts like Function Lifting, Dozen FP Operations for daily Programming like
- This is a fun-filled, code-driven Talk and without getting into definitions (which can be read through books), the attempt is to portray hands-on experience about how FP can help us become better developers.
Gopal S Akshintala is a Software Engineer at Salesforce, building a scalable B2C Payments Platform. He started as an Android Developer and switched to server-side as a Full-Stack Developer (Java for Backend, React Js for Frontend). Wearing multiple hats, aided him to perceive Patterns, Solutions and Trade-offs.
He believes Expressive Code is fun and profitable, which enthused him towards Functional Programming. He’s language geek, currently dabbling with other JVM languages like Clojure, Kotlin and Scala, lifting their goodies into his daily programming.
He loves being on Stage, as a Singer(http://bit.ly/agssc) and a Tech-Speaker. He gave tech-talks at Google developer Conference, Java User Group Hyderabad, Salesforce etc. He also blogs about Nature (http://leafOnTheWind.ga) and Programming (https://overfullstack.github.io)
- The code examples for this talk can be found here: (They are currently in Java and we be rewritten in Clojure, but the design remains the same)
- My Tech Blog : https://overfullstack.github.io