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:
“The sensual and spiritual are linked together by a mysterious bond, sensed by our emotions, though hidden from our eyes. To this double nature of the visible and invisible worldto the profound longing for the latter, coupled with the feeling of the sweet necessity for the former, we owe all sound and logical systems of philosophy, truly based on the immutable principles of our nature, just as from the same source arise the most senseless enthusiasms.”
—Karl Wilhelm Von Humboldt (17671835)
“It is a mistake, to think the same thing affects both sight and touch. If the same angle or square, which is the object of touch, be also the object of vision, what should hinder the blind man, at first sight, from knowing it?”
—George Berkeley (16851753)