首页 > 其他 > 详细

编码原则 之 Persistence Ignorance

时间:2018-12-29 12:47:07      阅读:139      评论:0      收藏:0      [点我收藏+]

原文

 

 

The principle of Persistence Ignorance (PI) holds that classes modeling the business domain in a software application should not be impacted by how they might be persisted.

Thus, their design should reflect as closely as possible the ideal design needed to solve the business problem at hand, and should not be tainted by concerns related to how the objects’ state is saved and later retrieved.

 

Some common violations of Persistence Ignorance include

  • domain objects that must inherit from a particular base class,
  • or which must expose certain properties.
  • Sometimes, the persistence knowledge takes the form of attributes that must be applied to the class,
  • or support for only certain types of collections
  • or property visibility levels.

There are degrees of persistence ignorance, with the highest degree being described as Plain Old CLR Objects (POCOs) in .NET, and Plain Old Java Objects (POJOs) in the Java world.

编码原则 之 Persistence Ignorance

原文:https://www.cnblogs.com/panpanwelcome/p/10195216.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!