Encapsulation (computer programming): Difference between revisions

Content deleted Content added
Kaikid (talk | contribs)
m treat data like a plural
Updated intro section which had some blatant inaccuracies. See "Wow is this bad" on Talk page for additional information. This is just a start; the whole article needs a rewrite.
Line 1:
{{Short description|Bundling of data}}
In [[object-oriented programming]]software (OOP)systems, '''encapsulation''' refers to the bundling of data with the mechanisms or methods that operate on thosethe data, or the restrictinglimiting of direct access to some ofdata, such as an object's components.<ref name="Rogers01" /> Encapsulation allows developers to present a consistent and usable interface which is independent of how a system is implemented internally. As one example, encapsulation can be used to hide the values or state of a structured data object inside a [[Class (computer programming)|class]], preventing direct access to them by clients in a way that could expose hidden implementation details or violate state invariance maintained by the methods.
 
ThisAll mechanism[[object-oriented programming]] (OOP) systems support encapsulation, but encapsulation is not unique to OOP. Implementations of [[abstract data types]], e.g., [[module (programming)|modules]], offerand a[[library similar(computing)|libraries]], formamong ofother systems, also offer encapsulation. The similarity has been explained by programming language theorists in terms of [[existential types]].<ref>{{harvnb|Pierce|2002|loc=§ 24.2 Data Abstraction with Existentials}}</ref>
 
== Meaning ==