All Posts

Article

Page 2 of 3

Retry, Timeout, and Backoff as Composable Functions

Retry, Timeout, and Backoff as Composable Functions

Retry loops, timeouts, and backoff usually arrive as tangled imperative code or a heavy resilience framework. There is a lighter option: model each policy as a function that wraps a function. Once retry, timeout, and backoff are ordinary higher-order functions, they compose — and you can read a call's full resilience behavior in one line.

Vavr, Arrow, Cats, fp-ts: What Problems Do They Solve?

Vavr, Arrow, Cats, fp-ts: What Problems Do They Solve?

Four libraries, four languages, one recurring motivation. Vavr, Arrow, Cats, and fp-ts exist because mainstream languages gave developers functional building blocks but left out the types that make them safe. This post maps what each library actually provides — and what gap in the host language each one fills.

How to Model Data Transformation Pipelines

How to Model Data Transformation Pipelines

Ad-hoc transformation code grows into spaghetti because there is no shared vocabulary for what a stage is, what it produces, or how failures propagate. Functional types give you that vocabulary — typed stage boundaries, composable error handling, and batch pipelines that separate failures from successes without stopping the whole run.

Currying and Partial Application in Practice

Currying and Partial Application in Practice

Currying sounds like academic theory. Partial application is something Java developers already do every day — they just don't name it. This post names it, distinguishes the two concepts, and shows five situations where partial application makes real production code cleaner.

Designing More Expressive APIs with Functional Types

Designing More Expressive APIs with Functional Types

A method signature is a contract. Most Java APIs break that contract silently — returning null, throwing undeclared exceptions, or hiding multiple outcomes behind a boolean. Functional types turn vague promises into honest, self-documenting interfaces.

Pattern Matching and Domain Modeling

Pattern Matching and Domain Modeling

Sealed types make your domain states explicit and exhaustive. Pattern matching forces every caller to handle them all. Together they turn a class of runtime surprises into compile-time errors — and make the business model readable in the type signatures.

Lazy Evaluation: When It Helps and When It Complicates Things

Lazy Evaluation: When It Helps and When It Complicates Things

Lazy evaluation defers a computation until its result is actually needed. That single idea eliminates wasted work, enables safe default values, and defers heavy initialization — but it also introduces traps around side effects, debugging, and error timing that you need to know before reaching for it.

Higher-Order Functions Explained with Real Examples

Higher-Order Functions Explained with Real Examples

Higher-order functions are not just map and filter. They are the mechanism behind every composable pattern in functional programming — Strategy, Decorator, Policy, pipeline — explained through real backend Java code.

How to Write More Predictable Code with Functional Programming

How to Write More Predictable Code with Functional Programming

Predictable code is code you can understand without reading everything around it. Functional programming gives you three concrete tools to get there: pure functions, honest signatures, and immutable values.