Passive data structure plain old data structure, or plain old data.

http://en.wikipedia.org/wiki/Passive_data_structure

In object-oriented programming and computer science, a passive data structure (PDS) is a term for a record, to contrast with objects. That is, a PDS is adata structure that is represented only as passive collections of field values (instance variables), without using object-oriented features.[1] It is also known as a plain old data structure, or plain old data.

Passive 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. PDSs are often found at the boundaries of a system, where information is being moved to and from other systems or persistent storage and the problem domain logic that is found in other parts of the system is not relevant. For example, PDS 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 valid objects have not yet been applied.

A PDS type in C++ is defined as either a scalar type or a PDS class.[2] A PDS class has no user-defined copy assignment operator, no user-defined destructor, and no non-static data members that are not themselves PDS. Moreover, a PDS class must be an aggregate, meaning it has no user-declared constructors, no private nor protected non-static data, no base classes and no virtual functions.[3] The standard includes statements about how PDS must behave in C++. The type_traits library in the C++ Standard Library, provides a function known as is_pod that can be used to determine whether a given type is a POD.[4]

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

In Java, some developers consider that the PDS concept corresponds to a class with public data members and no methods (Java Code Conventions 10.1),[1] i.e., a data transfer object.[5] Others would also include POJOs (a class that has methods but only getters and setters, with no logic) and Java Beans to fall under the PDS concept if they do not use event handling and do not implement additional methods beyond getters and setters.[citation needed] However,POJOs and Java Beans do have encapsulation and so violate the fundamental definition of PDS.

In PHP associated arrays and stdClass objects can be considered PDS.

Other structured data representations such as XML or JSON can also be used as a PDS if no significant semantic restrictions are used.


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值