Chapter 11. Refactoring and testing functional programs

This chapter covers

  • Refactoring functional programs
  • Reasoning about code using immutability
  • Writing unit tests for F# programs
  • Caching results using lazy values

One theme of this book is that functional programming makes it easier to understand code just by reading it. This is particularly important when you need to modify an unfamiliar program or implement behavior by composing existing functions or when refactoring existing code. Functional programming makes refactoring easier thanks to both clarity and modularity: you can make improvements to the code and be confident that the change doesn’t break other parts of the program.

As with many things in functional programming, the idea ...

Get Real-World Functional Programming 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.