liveBook · Manning

Immutability

Also called immutable

Immutability is the property of an object, data, or artifact that it is not modified in place after creation, with changes represented by a new value or version.

How 4 Manning books explain it

Functional Programming in C#, Second Edition

Immutability is the property of data or an object whose observable state cannot be changed after creation.

How it is used
Uses immutable values to represent changing domain state without in-place mutation, and extends the idea to historical storage.
How deep it goes
Explains modified copies, nested collection protection, performance costs, and integration hurdles, while deferring the efficiency of immutable list updates.
Examples
Illustrates unchanged dates, a readonly circle, account activation, and transaction history protected from mutable list inputs.
What you can do after
Apply immutability using C# records, with expressions, readonly record structs, and ImmutableList to model state changes.

Read how Functional Programming in C#, Second Edition explains immutability →

Grokking Software Architecture

Immutability is a system property in which deployed infrastructure is not modified in place but replaced with a new version when changes are required.

How it is used
Treats deployed application servers as replaceable versions rather than machines patched in place.
How deep it goes
Explains the principle, operational benefits, and database exception without detailing a deployment implementation.
Examples
Uses manually patched servers, immutable objects, server rollbacks, and rebuilt servers to illustrate the principle.
What you can do after
Apply it by rebuilding patched application servers and rerouting traffic to earlier frozen versions for rollback.

Read how Grokking Software Architecture explains immutability →

Java Persistence with Spring Data and Hibernate epub

An immutable instance is an object whose observable state cannot be changed after construction.

How it is used
Uses immutability for bids and link entities that are not changed after creation, reducing persistence work.
How deep it goes
Defines constructor-initialized, setter-free POJOs and Hibernate field access, but notes ORM constraints can prevent guaranteed immutability.
Examples
Shows an immutable auction Bid and a CategorizedItem link entity carrying additional relationship data.
What you can do after
Evaluate whether an entity can avoid updates and dirty checking while accounting for constructor and field-access requirements.

Read how Java Persistence with Spring Data and Hibernate epub explains immutability →

Spring Start Here, Second Edition

Immutability is the property that an object's state cannot be changed after initialization.

How it is used
Protects shared singleton beans from concurrent state changes and supports immutable data carriers at application boundaries.
How deep it goes
Explains final fields and race-condition risks, but does not detail synchronization implementation.
Examples
Uses a final CommentRepository dependency, contrasts field-injected Parrot, and recommends records for HTTP data carriers.
What you can do after
Apply it by using constructor injection and final dependencies for singleton beans, or records for HTTP data carriers.

Read how Spring Start Here, Second Edition explains immutability →

Also covered in

What to know first

Related concepts

Questions about immutability

What is immutability?

Immutability is the property of an object, data, or artifact that it is not modified in place after creation, with changes represented by a new value or version.

Which Manning books explain immutability?

Functional Programming in C#, Second Edition, Grokking Software Architecture, Java Persistence with Spring Data and Hibernate epub and Spring Start Here, Second Edition.

What should I know before learning immutability?

Manning books that teach immutability usually introduce functional programming, entity and list first.

What is the difference between immutability and dirty checking?

Immutability is the property of an object, data, or artifact that it is not modified in place after creation, with changes represented by a new value or version. Dirty checking is the persistence-engine process of detecting changes made to managed objects so they can be synchronized with the database.

What kinds of immutability are there?

Kinds of immutability include primitive type.

What is immutability a kind of?

Immutability is a kind of object. An object is a runtime entity that combines state with operations that act on that state.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.