Functional Programming
Functional programming centers on pure functions, immutable data, and a declarative style, avoiding side effects and shared state.
Purpose
Build reliable, testable code with function composition and immutable data.
Mechanism
Pure functions (no side effects), immutability, higher-order functions, lazy evaluation, function composition, currying. Haskell is purely functional; Scala/JS are multi-paradigm. Strengths: testable, parallelizable, reasoning-friendly. Weaknesses: learning curve, performance.
Use cases
- Code design
- Concurrency safety
- Testability