Functional programming composes computations as functions, keeps functions short, and minimizes mutable state by treating data as immutable. Short functions have fewer paths to test and are easier to understand, debug, and maintain. section 8.0
The approach relies on several practical habits:
- Pass functions as arguments to other functions. section 8.0
- Transform sequences of inputs into sequences of outputs instead of modifying existing data. section 8.0
- Combine functional techniques with object-oriented designs when each approach makes the code shorter and clearer. section 10.34
Replacing mutation with transformation
If an immutable Person needs a different name, create a new Person based on the old one rather than changing the existing object. In a Zoo class, generator expressions and sum can filter animals or total their legs without long procedural functions. section 8.0 section 10.34


















