Article about functional programming in kotlin#133
Open
patrickwilmes wants to merge 1 commit intoZuehlke:mainfrom
Open
Article about functional programming in kotlin#133patrickwilmes wants to merge 1 commit intoZuehlke:mainfrom
patrickwilmes wants to merge 1 commit intoZuehlke:mainfrom
Conversation
abishekanthony07
suggested changes
Nov 13, 2025
Contributor
abishekanthony07
left a comment
There was a problem hiding this comment.
All in all the Blog is really expressive and on point!
I have mostly added suggestions to Kotlin code. Feel free to challenge them!
Thank you Patrick!
Co-authored-by: Abishek Anthony <Abishek.Anthony@zuehlke.com>
051c867 to
3b05305
Compare
kunman93
reviewed
May 5, 2026
|
|
||
| ## Functional and Object-Oriented: Not Opposites, but Complements | ||
|
|
||
| There’s no single “superior” paradigm. Paradigms are tools, each emphasizing a different aspect of design. |
There was a problem hiding this comment.
Suggested change
| There’s no single “superior” paradigm. Paradigms are tools, each emphasizing a different aspect of design. | |
| There’s no single “superior” paradigm. Paradigms are tools, each emphasizing a different aspect of design. | |
| - **OOP** models the world with _entities_ and _behavior_. It gives structure and relationships. | ||
| - **FP** models _data transformations_. It focuses on purity, predictability, and composition. | ||
|
|
||
| Viewed together: |
There was a problem hiding this comment.
Suggested change
| Viewed together: | |
| Viewed together: | |
| - **FP** models _data transformations_. It focuses on purity, predictability, and composition. | ||
|
|
||
| Viewed together: | ||
| > **Use OOP to give your project structure, and FP to express logic clearly.** |
There was a problem hiding this comment.
Suggested change
| > **Use OOP to give your project structure, and FP to express logic clearly.** | |
| > **Use OOP to give your project structure, and FP to express logic clearly.** | |
|
|
||
| ### What Makes a Function Pure? | ||
|
|
||
| A pure function must satisfy two requirements: |
There was a problem hiding this comment.
Suggested change
| A pure function must satisfy two requirements: | |
| A pure function must satisfy two requirements: | |
| } | ||
| ``` | ||
|
|
||
| This is pure because: |
There was a problem hiding this comment.
Suggested change
| This is pure because: | |
| This is pure because: | |
| You can think of a **monad** as a _computation context_ — a box that carries both a value and its meaning | ||
| (was it successful, optional, deferred?). | ||
|
|
||
| A monad provides three operations: |
There was a problem hiding this comment.
Suggested change
| A monad provides three operations: | |
| A monad provides three operations: | |
| } | ||
| ``` | ||
|
|
||
| **Monads let you:** |
There was a problem hiding this comment.
Suggested change
| **Monads let you:** | |
| **Monads let you:** | |
| - Keep business logic clean | ||
| - Maintain purity—no hidden effects | ||
|
|
||
| Common monads you’ll encounter: |
There was a problem hiding this comment.
Suggested change
| Common monads you’ll encounter: | |
| Common monads you’ll encounter: | |
|
|
||
| ## When to Use Which Paradigm | ||
|
|
||
| ### Functional Programming Shines When |
There was a problem hiding this comment.
Suggested change
| ### Functional Programming Shines When | |
| ### Functional Programming Shines When | |
There was a problem hiding this comment.
Instead of using titles, I would have used a different format:
Functional programming shines when ...
- ... you're tranforming data.
- ... logic is complex but composable
- ...
| - You need thread safety | ||
| - You want testability and predictability | ||
|
|
||
| ### OOP Shines When |
There was a problem hiding this comment.
Suggested change
| ### OOP Shines When | |
| ### OOP Shines When | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.