4 Extracting calculations from actions

Image

In this chapter

  • Observe how information enters and leaves a function.
  • Discover functional techniques to make code more testable and reusable.
  • Learn how to extract calculations from actions.

In this chapter, we’re going to do a lot of refactoring. We’re going to look at an existing piece of software, add some features, and then refactor calculations out of the actions. This improves the reuse and testability of the code.

Welcome to MegaMart.com!

Where your shopping cart is always full

MegaMart is an online store. One of its key features, and how it stays competitive, is that the shopping cart always ...

Get Grokking Simplicity now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.