# Audience & Takeaways
- The [USP](https://en.wikipedia.org/wiki/Unique_selling_proposition) for this talk is, unlike majority FP talks in Java/Kotlin space, which are either introductory or advanced, this has something for all levels of the audience.
- This talk starts with basic FP concepts like _Imperative vs. Declarative_ style using Java **Streams** or Kotlin **Sequences**.
- Then the audience is gradually ramped-up towards intermediate FP concepts such as _Monads_, _First-Class Functions_ , _Higher-Order Functions_.
- Towards the end, we touch-upon concepts for an advanced audience like _Function-Lifting_, _Dozen FP Operations for daily Programming like `foldLeft`_ within the context of the problem, with pictures and simple examples. They are also provided with appropriate pointers wherever needed, to go back and refer.
- The audience experiences a mind-shift from the traditional mutation-heavy _Imperative style_ to _Functional style_ -- with Immutable Objects (Using Java `Records` or Kotlin's `Data classes`) and Pure-Functions (replacing Mutation with Transformation).
- With Hands-on demos, this talk adds a robust paradigm toolset and vocabulary to a programmer's arsenal and how to apply them to simplify the modeling and designing of complex _real-world_ problems.
- The audience learns how to objectively perceive complexity in any codebase through metrics (measured using popular static analysis tools), and how to reduce cognitive complexity methodically.
- Finally, we shall talk about how these concepts laid foundation stones to our in-house library **Vader**, a bean validation framework.
# Source-Code
The concepts are language agnostic. For broader outreach, I can use either of these two for a hands-on demo:
- **[Kotlin](https://kotlinlang.org/)** (a Modern Open-source JVM language) + **[Arrow](https://arrow-kt.io/)** (a Trending Open-source functional companion for Kotlin)
_(or)_
- **Java** + **[Vavr](https://www.vavr.io/)** (an Open-source functional library for Java)
As I cannot use the production code, I use code samples from my POC for the demonstration -- [Github repo for Java](https://github.com/overfullstack/railway-oriented-validation) or [Github repo for Kotlin](https://github.com/overfullstack/railway-oriented-validation-kotlin).
The code references in this post point to Java repo, but they can be correlated by name with the Kotlin repo.
# Talk Outline
- This talk has 2 stories embedded. The first part explains the differences between Imperative and Declarative styles and demonstrates the **Core:Context** philosophy behind the declarative style, which helps in separating **How-to-do** from **What-to-do**, using Java Streams or Kotlin Sequences.
- 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-service Domains_ - **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's NOT extensible if any of these three scales - Request Batch size, Validation count and Services count.
- Then the talk offers a Functional Programming (FP) solution, using Monads and Lambdas, which **Minimizes the accidental complexity without compromising Time complexity (Perf)**, and can seamlessly be extended.
- Throughout this talk, Simple Monads (like `Option`, `Either`, `Try` etc.,) are introduced and how they fit in the context of the problem.
- This talk attempts to ramp-up the audience on functional programming gradually, and towards the end, we touch upon advanced concepts like Higher-Order Functions, Function Lifting, Dozen FP Operations for daily Programming like `foldLeft` etc.
- This talk is a fun-filled, code-driven, and without getting into definitions (which can be read from books), the attempt is to portray hands-on experience about how FP can help us become better developers.