Immutable Object

In object-oriented and functional programming, an immutable object is an object whose state cannot be modified after it is created. This is in contrast to a mutable object, which can be modified after it is created. In some cases, an object is considered immutable even if some internally used attributes change but the object's state appears to be unchanging from an external point of view. For example, an object that uses memoization to cache the results of expensive computations could still be considered an immutable object.

Immutable objects are often useful because they are inherently thread-safe. Other benefits are that they are simpler to understand and reason about and offer higher security than mutable objects.

Read more about Immutable Object:  Background, Implementation, Copy-on-write, Usage

Famous quotes containing the words immutable and/or object:

    A miracle is the violation of mathematical, divine, immutable, eternal laws. By this very statement, a miracle is a contradiction in terms. A law cannot be immutable and violable at the same time.... God cannot do anything without reason; so what reason could make him temporarily disfigure his own handiwork?
    Voltaire [François Marie Arouet] (1694–1778)

    It is the nature of our desires to be boundless, and many live only to gratify them. But for this purpose the first object is, not so much to establish an equality of fortune, as to prevent those who are of a good disposition from desiring more than their own, and those who are of a bad one from being able to acquire it; and this may be done if they are kept in an inferior station, and not exposed to injustice.
    Aristotle (384–322 B.C.)