Difference between revisions of "Immutable"

From PKC
Jump to navigation Jump to search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{WikiEntry|key=Immutable|qCode=95963068}} is a kind of Immutable Data Collections.
{{WikiEntry|key=Immutable|qCode=95963068}} is a kind of data that once written, cannot be changed. It is a property often associated with [[blockchain]]-based data storage.
=Excerpts from Wikipedia=
=Excerpts from Wikipedia=
In [[wikipedia:object-oriented computer programming|object-oriented]] and [[wikipedia:Functional programming|functional]] programming, an '''immutable object''' (unchangeable<ref>{{cite web|url=http://www.oxfordlearnersdictionaries.com/definition/english/immutable|title=immutable adjective - Definition, pictures, pronunciation and usage notes - Oxford Advanced Learner's Dictionary at OxfordLearnersDictionaries.com|website=www.oxfordlearnersdictionaries.com}}</ref> object) is an [[wikipedia:object (computer science)|object]] whose state cannot be modified after it is created.<ref name=Goetz>Goetz et al. ''Java Concurrency in Practice''. Addison Wesley Professional, 2006, Section 3.4. Immutability</ref> This is in contrast to a '''mutable object''' (changeable object), which can be modified after it is created. <ref>{{cite web|url=https://web.mit.edu/6.005/www/fa16/classes/09-immutability/|title=6.005 — Software Construction}}</ref> In some cases, an object is considered immutable even if some internally used attributes change, but the object's state appears unchanging from an external point of view. For example, an object that uses <!--
In [[wikipedia:object-oriented computer programming|object-oriented]] and [[wikipedia:Functional programming|functional]] programming, an '''immutable object''' (unchangeable object) is an [[wikipedia:object (computer science)|object]] whose state cannot be modified after it is created. This is in contrast to a '''mutable object''' (changeable 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 unchanging from an external point of view. For example, an object that uses <!--
YES, THIS IS SPELLED CORRECTLY. IT'S *NOT* "memo*r*ization". READ THE LINKED ARTICLE.
YES, THIS IS SPELLED CORRECTLY. IT'S *NOT* "memo*r*ization". READ THE LINKED ARTICLE.
-->[[wikipedia:memoization|memoization]] to cache the results of expensive computations could still be considered an immutable object.
-->[[wikipedia:memoization|memoization]] to cache the results of expensive computations could still be considered an immutable object.


Strings and other concrete objects are typically expressed as immutable objects to improve readability and runtime efficiency in [[wikipedia:object-oriented programming|object-oriented programming]]. Immutable objects are also useful because they are inherently [[Thread safety|thread-safe]]. Other benefits are that they are simpler to understand and reason about and offer higher security than mutable objects.
Strings and other concrete objects are typically expressed as immutable objects to improve readability and runtime efficiency in [[wikipedia:object-oriented programming|object-oriented programming]]. Immutable objects are also useful because they are inherently [[wikipedia:Thread safety|thread-safe]]. Other benefits are that they are simpler to understand and reason about and offer higher security than mutable objects.

Latest revision as of 03:43, 14 June 2022

Immutable(Q95963068) is a kind of data that once written, cannot be changed. It is a property often associated with blockchain-based data storage.

Excerpts from Wikipedia

In object-oriented and functional programming, an immutable object (unchangeable object) is an object whose state cannot be modified after it is created. This is in contrast to a mutable object (changeable 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 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.

Strings and other concrete objects are typically expressed as immutable objects to improve readability and runtime efficiency in object-oriented programming. Immutable objects are also 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.