Immutable object

Updated: 10/11/2017 by Computer Hope

In computer programming, an immutable object is an object that the programmer cannot change after creating it. Immutable objects are primarily found in functional and object-oriented programming languages.

Benefits of using immutable objects

  • Higher security — an object cannot be altered cannot be used for a purpose other than its original intent.
  • Thread-safety — in a multi-threaded program, immutable data cannot be incidentally overwritten by another concurrent thread.
  • Simplicity — it is easier to debug and analyze a program's behavior if a large set of objects remain the same throughout the program's execution.

Object-oriented programming, Programming terms