7 Immutability at scale with persistent data structures

 

7.1 Introduction

In Part 1, we illustrated how to manage the state of a system without mutating data, where immutability is kept by constraining ourselves to manipulate the state only with immutable functions, leveraging structural sharing.

In the current chapter, we present a safer and more scalable way to preserve data immutability by representing data with persistent data structures. Persistent data structures prevents from data to be modified at the level of the data structure itself and allow us to create new versions of data efficiently, both in terms of computation and memory, no matter the data size.

There exist implementations of persistent data structures for most programming languages via third party libraries.

7.2 The need for persistent data structures

 

7.3 The efficiency of persistent data structures

 
 
 
 

7.4 Persistent data structures libraries

 
 
 
 

7.4.1 Persistent data structures in Java

 
 
 

7.4.2 Persistent data structures in JavaScript

 
 

7.5 Persistent data structures in action

 
 
 

7.5.1 Writing queries with persistent data structures

 
 

7.5.2 Writing mutations with persistent data structures

 
 
 

7.5.3 Serialization and deserialization

 
 
 

7.5.4 Data diff

 
 
 
 

7.6 Wrapping up

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest