Chapter 1
The Paradigm Map
Same problem, five ways
Every modern language borrows from several paradigms, but each one has a default flavor that shapes how you think while writing it. The fastest way to feel the difference is to solve the same tiny problem five ways. Pick a card below and notice which style matches the way your brain naturally wants to write code.
Pipeline · Functional
nums
filter
map
reduce
= 220
Pros
- +Reads like a pipeline
- +Pure — easy to test
- +Composes and parallelizes well
Cons
- −Can hide allocations
- −Stack traces are less direct
- −Slower in naive engines
Key takeaways
- Modern languages are multi-paradigm — pick the style that fits the problem
- Imperative tells the machine how; declarative tells it what
- Functional pipelines compose tiny pure operations into a single flow
- No paradigm is universally best — every choice trades clarity for control