understand. • Be DRYer than DRY by having more agnostic code that’s highly reusable. • Accidental future proofing through malleable code that’s composable to change the intent. • Less refactor time by instilling less dictatorial patterns on every class. • Better unit tests by reducing the use of mocks and fixtures (they have a very bad code smell). • Better semantic variable naming over comments (which easily become outdated). • Code is easier to reason about because it’s not affected by state mutations in other classes. * Also look into Immutable data structures because they reset the performance characteristics to make code that’s easier to engineers to reason about also be performant for the CPU. The Goals of Functional Programming
multiple approvals and rejections for a business management process. It is written using standard OOP practices that we’ll walk through a refactor to FP and discuss the trade-off and FP terminology. Sample Project
and easy to test. 2. Functions can be reused in ways you didn't think of when it was created. 3. Simple functions are easy to understand. 4. Refactoring FP compared to OOP happens less frequently. 5. Encapsulate dependencies so other external functions don't need to know about it. Curry more. How to be Functional. 1. Operate on a single simple object first. 2. Compose all things. 3. Think in terms of transforming an object from one structure to another; not step by step operations. 4. Don't micro-optimize (don't worry about lots of little allocations). If you have bigger operations look into immutable data. 5. Just like when thinking of class method, think about a function’s arguments and order. Functions with the exact same argument count (and sometimes type) can be reused in order functions.