Skip to content

Immutability

September 29, 2023
December 4, 2015

Most of the study gears towards JavaScript/web development

Immutability

Immutable app state probably will help you to enforce mutation from single component. Passing snapshot of the immutable state as props to child allows you to define your component as "pure" to boost performance.

A naive implementation of immutability is to a deep clone the original data, then return the mutated copy.
A more performant implementation is to use persistent data structure (structural sharing), where only the mutated fields and the nodes reaching from the root to the field have to be updated.

Immutable object - Wikiwand
Persistent data structure - Wikiwand

List of immutable libraries
immutable-data.md · markerikson/redux-ecosystem-links

Immutable.js structural sharing
arqex/freezer
rtfeldman/seamless-immutable no structural sharing
kolodny/immutability-helper: mutate a copy of data without changing the original source no structural sharing
debitoor/dot-prop-immutable: Immutable version of dot-prop with some extensions
mariocasciaro/object-path-immutable: Modify deep object properties without modifying the original object (immutability). Works great with React and Redux.
Gozala/typed-immutable
mori structural sharing
scottcorgan/immu
substantial/updeep: Easily update nested frozen objects and arrays in a declarative and immutable manner. utilize lodash, no structural sharing

Introduction to Immutable.js and Functional Programming Concepts
Introduction to Immutable.js | Zsolt Nagy
02-immutable.js (PDF)

Immutability is not enough functional steps have dependency => effect systems
The Dao of Immutability — JavaScript Scene — Medium
Immutability in JavaScript
Immutable Javascript using ES6 and beyond
Immutable Data from Scratch - RYANFUNDUK.COM
Immutable Data Structures and JavaScript

React.js Conf 2015 - Immutable Data and React - YouTube use trie to implement the map and list interfaces
Immutable User Interfaces (Lee Byron) - Full Stack Fest 2016 - YouTube