码迷,mamicode.com
首页 > 其他好文 > 详细

编码原则 之 Persistence Ignorance

时间:2018-12-29 13:43:37      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:ora   java   scribe   with   plain   Once   problem   get   原则   

原文

 

 

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

标签:ora   java   scribe   with   plain   Once   problem   get   原则   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!