JavaBean, POJO, VO, DTO, DAO 异同

refs:

https://dzone.com/articles/database-interaction-dao-and

http://java-base.com/javabean-vs-dto-vs-pojo-jknb/


Plain Old Java Object (POJO)

The name is used to emphasize that a given object is an ordinary Java Object, not a special object. It has absolutly no restrictions.

POJO, or Plain Old Java Object, is a normal Java object class (that is, not a JavaBean, EntityBean etc.)  and does not serve any other special role nor does it implement any special interfaces of any of the Java frameworks. This term was coined by Martin Fowler, Rebbecca Parsons and Josh MacKenzie who believed that by creating the acronym POJO, such objects would have a “fancy name”, thereby convincing people that they were worthy of use.


JavaBean

JavaBean is a simple java class or POJO, but with some restrictions. This is the main difference between a POJO and a JavaBean. Some of the restrictions are:

  • JavaBean should provide default public constructor.
  • JavaBean should provide property accessor methods (getters and setters).
  • JavaBean should be serializable.

JavaBean is a example of POJO that is serializable, has a no-argument constructor, and allows access to properties using getter and setter methods that follow a simple naming convention.

Value Object (VO)

Value Object is simple object that holds values. The VO should be entirely immutable.

Data Transfer Object (DTO)

DTO is serializable object, which is used for transfering data between different processes. It shouldn’t be mixed with VO. This is exposed as design pattern.

Data Access Object (DAO)

This is an object, which provides mechanism for accessing objects from the persistance layer. This is actually one of the most popular design patterns.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值