In chapter 1, Becoming Functional - Several Questions, we went over what FP is, mentioned some advantages of applying it, and listed some tools we'd be needing in JS... but let's now leave theory behind, and start out by considering a simple problem, and how to solve it in a functional way.
In this chapter, we will see:
- A simple, common, e-commerce related problem
- Several usual ways to solve it, with their associated defects
- A way to solve the problem by looking at it functionally
- A higher-order solution, which can be applied to other problems
- How to do unit testing for the functional solutions
In future chapters, We'll be coming back to some of the topics listed here, so we won't be getting very much into details. We'll just show how FP can give a different outlook for our problem, and leave further details...