Business Layer

1. Difference between BO and DTO

A business object contains both data and behavior, and it can be considered a full-fledged active object participating in the domain logic. A data-transfer object is a sort of value object—namely, a mere container of data with no attached behavior. The data stored in an instance of a BO is typically copied into a DTO for serialization purposes. The DTO has no logical behavior except for get accessors and set mutators. There might be multiple DTOs for each domain entity class in the model. Why multiple DTOs?

A DTO is not simply a behaviorless copy of a domain object. It is, instead, an object that represents a subset of a particular domain object as you would use it in a particular context. For example, in one method you might need a Customer DTO with only the company name and ID; elsewhere, you might need another one with the ID, company name, country, and contact information. Generally, however, a domain object is a graph of objects—for example, the Customer includes orders, which include order details, and so forth. A DTO indicates any needed projection of this aggregate.


2. Layer vs Tier

A layer is merely a way of organizing your code. When you mention the presentation layer, for instance, you are referring to the functions that you expect from the application's front end. You are not referring to a particular client platform or technology. Or, at least, you shouldn't be.

A tier, on the other hand, refers to where the code runs. For this reason, a tier is often referred to as a physical tier, or perhaps a physical layer. More specifically, a tier is the place where architects make logical layers run.




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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值