immutable
Something that cannot be changed after it is created; to change it you make a new one.
In more detail
Immutable values are safe to share between parts of a program and to use as dictionary keys, because nothing can change them afterwards. Updating one means building a new value. Numbers and strings are immutable in most languages.
Examples
In Python, int, str, tuple and frozenset are immutable; list, dict and set are not.In the twelve-factor app a release is immutable: to change anything you create a new release. A pipeline builds one immutable artifact and promotes those same bytes, so what was tested is what runs.Java: strings and records are immutable, though a record holding an ArrayList is only shallowly so.Kafka records are immutable once written: an update is a new record.In React, props, state and elements are treated as immutable; React freezes props and elements in development builds so accidental writes fail loudly.Related terms
- mutable — Able to be changed in place after it is created, like most lists, arrays and objects in languages such as Python and JavaScript.
- hashable — Describes a Python object that has a hash value that never changes during its lifetime and can be compared for equality, so it can be a dict key or set member.
- tuple — An ordered, fixed-length group of values in which each position can have its own meaning and type.
- artifact — A file produced by a build, such as a compiled program or an image, that is stored and passed on to later steps.
- build, release, run — Three strictly separate stages: build turns code into a bundle, release joins it to one deploy config with an identifier, and run starts processes from a chosen release.
- append-only — Describes a record you can only add new entries to, never edit or delete existing ones.
- digest — A SHA-256 hash of an image's manifest that identifies its exact content and can never be moved to other bytes.
- cache key — The name a cache entry is saved and looked up under, usually built from the operating system and a hash of the lock file.
- object ID — The hash that names a Git object, such as a commit, and that you type to refer to it.
- tag — A human-readable label such as 3.20 or latest attached to an image in a repository, which can be moved to point at a different image.
- layer — One read-only slice of an image that records the files a single build step added, changed or deleted.
- final — A Java keyword meaning cannot be changed further: a final field is assigned once, and a final class cannot be extended.
- record (Java) — A compact Java class for plain data, declared with its components in one line, for which the compiler generates the fields, accessors, equals, hashCode and toString.
- mutable state — Data that can change after it is created, such as a field that is reassigned or a list that is added to.
- defensive copy — A copy of a mutable object, such as a list, made when it crosses a boundary so the other side cannot change your data.
- append-only log — A data structure where new entries are only ever added at the end and existing entries are never changed in place.
- Kafka record — One entry in a Kafka topic, made of an optional key, a value, optional headers and a timestamp.
- string — A sequence of characters, that is, a piece of text.
- mutation — A change to data, and in TanStack Query or tRPC specifically, a request that creates, updates or deletes data on the server.
- spread syntax — The three-dot JavaScript syntax that copies the items of an array or the properties of an object into a new one.
- prop — An input passed to a React component, written like an HTML attribute, such as size="lg" in <Button size="lg">.
- Cosign — Sigstore's tool for signing and verifying container images and attaching signed attestations such as SBOMs.
- readonly — A modifier, in languages such as C# and TypeScript, that lets a field or property be assigned only when it is initialised, never afterwards.
- as const — The TypeScript suffix as const, which tells the compiler to treat an object's values as fixed literal values rather than general types.
Taught in
- Python Dicts And Sets Under The Hood — Algorithms & Data Structures for Working Engineers
- Sorting In Real Systems: Stability, Keys And External Sort — Algorithms & Data Structures for Working Engineers
- Artifacts: Where Packages And Images Live, And Die — AWS Certified DevOps Engineer – Professional (DOP-C02) Exam Prep
- Strategies Across Compute: The Canary That Saw Nothing — AWS Certified DevOps Engineer – Professional (DOP-C02) Exam Prep
- Speeding Up Builds: Caching Dependencies — Continuous Integration & Continuous Delivery Pipelines
- Building and Pushing Container Images — Continuous Integration & Continuous Delivery Pipelines
- Artifact Promotion: Staging to Production — Continuous Integration & Continuous Delivery Pipelines
- Blue/Green With Labels And A Service — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ServiceAccounts And Tokens — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Backup Architectures: 3-2-1, Immutability & Air-Gaps — Cybersecurity Fundamentals, GRC & Cryptography
- Build, Release, Run And Processes — DevOps & Site Reliability Engineering
- Continuous Integration — DevOps & Site Reliability Engineering
- Building And Versioning The Artifact — DevOps & Site Reliability Engineering
- Containers And Orchestration Context — DevOps & Site Reliability Engineering
- Environment, Secret Files And Runtime Restrictions — Docker Architecture & Production Containers
- The C# Language: Types, Variables, and Flow Control — Modern .NET Core, C# & Enterprise Microservices
- Records, Pattern Matching, and Modern C# — Modern .NET Core, C# & Enterprise Microservices
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform
- Generics Fundamentals — Modern Java: Virtual Threads & High-Throughput Services
- Records And Data Classes — Modern Java: Virtual Threads & High-Throughput Services
- Async With CompletableFuture — Modern Java: Virtual Threads & High-Throughput Services
- Strings, StringBuilder And Text Blocks — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Dates, Times And Daylight Saving — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Sprint: Values And Flow — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Overloading And Varargs — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Scope, var And Immutable Objects — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Lists, Sets, Maps, Deques And Sequenced Collections — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Sprint: Exceptions, Arrays And Collections — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Sprint: I/O And Localization — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Mock Exam: Sit It, Score It — Oracle Certified Professional: Java SE 21 Developer (1Z0-830) Exam Prep
- Why A Log And Not A Queue — Apache Kafka & Event Streaming
- Dictionaries — Hands-on Python: Complete Video Course & Book
- Chapter One In One Sitting — Hands-on Python: Complete Video Course & Book
- Objects, Methods And String Case — Hands-on Python: Complete Video Course & Book
- Mutable Objects And Aliases — Hands-on Python: Complete Video Course & Book
- Lists, Tuples, Sets, Dicts: Choosing One — Hands-on Python: Complete Video Course & Book
- JSX Transpilation: createElement, JSX Runtime, React Elements — React 19 & Modern Component Architecture
- Props Contract: Immutability, Children, And Polymorphic Tags — React 19 & Modern Component Architecture
- State with useState: Immutability And Asynchronous Batching — React 19 & Modern Component Architecture
- useSyncExternalStore: Tearing-Free Store Subscriptions — React 19 & Modern Component Architecture
- Provenance And Signing — Application Security & Threat Modeling for Engineers
- Image Scanning And Trivy — Application Security & Threat Modeling for Engineers
- Type Annotations, Type Inference And Contextual Typing — Production TypeScript
- Primitive Types: String, Number, Boolean, Bigint And Symbol — Production TypeScript
- Optional Properties, Readonly And Index Signatures — Production TypeScript
- Tuples: Fixed Length, Labeled Elements And Variadic Tuples — Production TypeScript
- Const Type Parameters: Retaining Literal Types In Functions — Production TypeScript
- Core Utilities: Partial, Required, Readonly, Pick And Omit — Production TypeScript
- Mapped Types, Key Remapping With as And Template Literals — Production TypeScript
- The satisfies Operator: Safe Validation Without Widening — Production TypeScript
- Tuples, And The Comma That Makes Them — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Dictionaries: Keys, Values And Items — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Strings: Escapes, Slices And Methods — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Twelve Traps, One Shape Each — PCEP Certified Entry-Level Python Programmer (PCEP-30-02) Exam Prep
- Characters As Numbers — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Comparing, Slicing And Never Changing — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- Strings Sprint — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
- read, readline, errno And bytearray — PCAP Certified Associate in Python Programming (PCAP-31-03) Exam Prep
References
- Python glossary: immutable
- NIST glossary: immutable
- OCI descriptor and digests
- GitHub Docs: Dependency caching reference
- Java 21 language guide: Record Classes
- dev.java: Using Records to Model Immutable Data
- MDN glossary: immutable
- React: Treat state as read-only
- MDN: Object.freeze()
Certification courses
- AWS DevOps Engineer Professional course and practice exam: DOP-C02
- CKAD course and practice exam: Certified Kubernetes Application Developer
- 1Z0-830 course and practice exam: Oracle Java SE 21 Developer Professional
- PCEP course and practice exam: Certified Entry-Level Python Programmer
- PCAP course and practice exam: Certified Associate in Python Programming