State - Immutable

Data System Architecture

About

A state who is immutable cannot be changed.

An variable (object) is considered immutable if its state cannot change after it is constructed.

Immutable objects are particularly useful in concurrent applications. Since they cannot change state, they cannot be:

Rules

  • Don't provide “setter” methods — methods that modify fields or objects referred to by fields.
  • Make all fields final and private (ie have a local scope)

Immutable objects are great. But sometimes refactoring an existing class to be immutable is really hard because code design implies that you need to publish an object before filling it completely. Still, you can improve your code.

Documentation / Reference





Discover More
Data System Architecture
Concurrency - Thread Interference (Interleave on shared data)

Same name than ? how errors are introduced when multiple threads access shared data. Interference happens when two operations, running in different threads, but acting on the same data, interleave....
Data System Architecture
Database management system (DBMS)

A DBMS is an application that controls: the organization, storage, management, and retrieval of data. A database is a collection of permanently stored data used by an application or enterprise....
Card Puncher Data Processing
Event-Data Application

are event-driven application that reports / analyze the immutable event collected (without any notion of a pre-defined lifecycle). An event-driven application is a stateful application that: ingest...
Java Conceptuel Diagram
Java Concurrency - Immutable Object

Immutable object in Java Concurrency. Don't provide “setter” methods — methods that modify fields or objects referred to by fields. Make all fields final and private. Don't allow subclasses...
Data System Architecture
Logical Data Modeling - Primary Key (Id, Name)

A Primary Key is a key that identify indefinitely uniquely an element: entity or a in their local scope. It's a part of the fully qualified identifier. A real primary key is immutable as...
Card Puncher Data Processing
Object - (Mutator|Setter|Set) method

Mutators are methods. Their role are to set the values of an object's state The usages are: central point of control for the input in order to reject bad data change detection (if the value is not...
Data System Architecture
State - Mutable

A state who is mutable can be changed. Mutation happens with mutator method: in CRUD term, they are known as Create, Update, Delete at a object level, they are known as the mutator method (ie set,...



Share this page:
Follow us:
Task Runner