Plain Old Data Structures

Plain Old Data Structures

Plain Old Data Structures (PODS) are data structures that are represented only as passive collections of field values, without using encapsulation or other object-oriented features.

Plain Old Data Structures are appropriate when there is a part of a system where it should be clearly indicated that the detailed logic for data manipulation and integrity are elsewhere. PODS are often found at the boundaries of a system, where information is being moved to and from other systems or persistent storage, and the business logic that is found in other parts of the system is not relevant. For example, PODS would be convenient for representing the field values of objects that are being constructed from external data, in a part of the system where the semantic checks and interpretations needed for true objects have not yet been applied.

A Plain Old Data Structure in C++ is an aggregate class that contains only PODS as members, has no user-defined destructor, no user-defined copy assignment operator, and no nonstatic members of pointer-to-member type. This implies that a C++ Plain Old Data Structure inherits only nonvirtually from other PODS, if at all. These restrictions ensure that the compiler or program can initialize, copy, and assign to PODS using only primitive memory copying functions and machine instructions.

In certain contexts, C++ allows only PODS to be used. For example, a union in C++ cannot contain a class that has virtual functions, or nontrivial constructors or destructors. This restriction is imposed because the compiler cannot know which constructor or destructor should be called for a union. PODS can also be used for interfacing with C, which supports only PODS.

In Java, some developers consider that the PODS concept corresponds to a class with public data members and no methods. Others would use a class that has methods but only getters and setters, with no logic. Java Beans fall under the PODS concept if they do not use event handling, and do not implement additional methods beyond getters and setters.

Other structured data representations such as XML can also be used as PODS if no significant semantic restrictions are used.

Related notes

For template-based classes in C++, it is sometimes appropriate to provide a template specialization for a PODS class that can implement moving or copying more efficiently. See Modern C++ Design.

Although it is sometimes thought that "Plain Old Data" is only an informal term that should be avoided in general communications, a POD notion is defined in ISO/IEC standard 14882 for the C++ programming language. A POD type in the standard is either a scalar type or a POD class. POD class has no user-defined copy assignment operator, no user-defined destructor, and no non-static data members that are not themselves PODs. Moreover, POD class must be an aggregate, meaning it has no user-declared constructors, no private nor protected non-static data, no bases and no virtual functions. The standard includes statements about how PODs must behave in C++.

References

*
* [http://www.fnal.gov/docs/working-groups/fpcltf/Pkg/ISOcxx/doc/POD.html "C++ Language Note: POD Types"] , by Walter E. Brown, Fermi National Accelerator Laboratory, September 29, 1999; last updated November 29, 1999.

ee also

* Plain Old Java Object


Wikimedia Foundation. 2010.

Игры ⚽ Поможем написать реферат

Look at other dictionaries:

  • Plain Old Java Object — POJO is an acronym for Plain Old Java Object, and is favoured by advocates of the idea that the simpler the design, the better.The name is used to emphasize that the object in question is an ordinary Java Object, not a special object, and in… …   Wikipedia

  • Plain Old Java Object — POJO est un acronyme qui signifie Plain Old Java Object que l on peut traduire en français par bon vieil objet Java. Cet acronyme est principalement utilisé pour faire référence à la simplicité d utilisation d un Objet Java en comparaison avec la …   Wikipédia en Français

  • Plain Old CLR Object — POCO es un acrónimo de Plain Old CLR Object. Es un juego de palabras del POJO de la plataforma Java, y es utilizado por los desarrolladores de la plataforma .NET Framework. Un POJO (Plain Old Java Object) es una sigla creada por Martin Fowler,… …   Wikipedia Español

  • Plain Old Java Object — Un POJO (acrónimo de Plain Old Java Object) es una sigla creada por Martin Fowler, Rebecca Parsons y Josh MacKenzie en septiembre de 2000 y utilizada por programadores Java para enfatizar el uso de clases simples y que no dependen de un framework …   Wikipedia Español

  • Data structure — In computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.[1][2] Different kinds of data structures are suited to different kinds of applications, and some are highly …   Wikipedia

  • Data type — For other uses, see Data type (disambiguation). In computer programming, a data type is a classification identifying one of various types of data, such as floating point, integer, or Boolean, that determines the possible values for that type; the …   Wikipedia

  • Old Louisville — Residential District U.S. National Register of Historic Places U.S. Historic district …   Wikipedia

  • Old Dutch Church of Sleepy Hollow — North profile and west elevation, 2009 …   Wikipedia

  • Old Town Township, McLean County, Illinois — Old Town Township   Township   Location in McLean County …   Wikipedia

  • POJO — est un acronyme qui signifie Plain Old Java Object que l on peut traduire en français par bon vieil objet Java. Cet acronyme est principalement utilisé pour faire référence à la simplicité d utilisation d un Objet Java en comparaison avec la… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”