O'Reilly logo

Functional Programming in C#: How to write better C# code by Enrico Buonanno

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 10. Event sourcing: a functional approach to persistence

This chapter covers

  • Thinking functionally about persisted data
  • Event sourcing concepts and implementation
  • Architecture of event-sourced systems

In the last chapter, you saw that in FP we avoid mutating state, especially global state. Did I mention that the database is also state, so it too should be immutable? What? Yes, didn’t you see this one coming? A database is, conceptually, just a data structure. Whether it’s stored in memory or on disk is ultimately just an implementation detail.

You saw how functional data structures, although immutable, can “evolve.” That is, you can create new “states” or new “views” of any given structure, which are built upon, but don’t alter, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required