liveBook · Manning

Mutable object

A mutable object is an object whose state can be changed after it is created.

How 5 Manning books explain it

F# in Action: A Revised Edition of Get Programming with F#

Mutability is the property of data whose state can be changed after creation.

How it is used
Contrasts in-place state changes with returning updated data when modeling application behavior.
How deep it goes
Explains object updates and hidden side effects, then works through mutable and immutable gas-tank state; does not detail object internals.
Examples
Uses a gas-tank simulation, hard-to-reproduce bugs, and locally scoped StringBuilder updates.
What you can do after
Evaluate/understand when changing shared state obscures behavior and when returned values or tightly scoped mutation make code easier to test.

Read how F# in Action: A Revised Edition of Get Programming with F# explains mutable object →

The Art of Code

Mutability is the property of a value or data structure whose contents can change after creation.

How it is used
Uses mutable data to illustrate hidden side effects in data modeling and imperative programming.
How deep it goes
Defines mutability and traces a shared-reference bug through copying and non-destructive filtering alternatives.
Examples
Uses country-coded product counts and an imperative word-filtering loop to demonstrate mutation.
What you can do after
Diagnose unintended list changes caused by shared references and replace destructive filtering with a non-destructive count.

Read how The Art of Code explains mutable object →

Refactoring to Rust

Mutability is the property of a value or data structure that permits its contents to be changed after creation.

How it is used
Uses explicit mutability to control reassignment, in-place updates, and growing string buffers.
How deep it goes
Explains annotations, mutable references, scope-based reference dropping, String capacity, and reallocation without covering concurrent Rust details.
Examples
Uses integer variables, an artwork view counter, repeated string appends, and preallocated string capacity.
What you can do after
Apply it by declaring mutable Rust variables, passing mutable references, and choosing string capacity for repeated appends.

Read how Refactoring to Rust explains mutable object →

Julia as a Second Language

A mutable type is a Julia type whose instances can have their fields modified after creation.

How it is used
Enables functions and collection-like operations to update fields of Julia composite objects after construction.
How deep it goes
Defines mutability, demonstrates field updates, and explains why changing a type definition requires restarting the REPL.
Examples
Uses an archer spending arrows and a staged rocket adding or removing stages.
What you can do after
Build it from scratch: define a mutable struct and write functions that update its fields.

Read how Julia as a Second Language explains mutable object →

Fabulous Adventures in Data Structures and Algorithms

A mutable data structure is a data structure whose contents can be changed after it is created.

How it is used
Uses mutation for convenient construction and direct updates when preserving multiple historical states is unnecessary.
How deep it goes
Defines mutation, contrasts copying costs, and demonstrates encapsulated C# trie-node operations without developing a general mutation theory.
Examples
Uses integer arrays, mutable trie nodes, and command-based undo-redo state as concrete examples.
What you can do after
Evaluate when direct mutation is simpler than version sharing, and build encapsulated mutable trie nodes in C#.

Read how Fabulous Adventures in Data Structures and Algorithms explains mutable object →

Related concepts

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.