Entity Control Boundary (ECB) vs Model View Controller (MVC)

早过忘川 提交于 2020-01-16 06:48:09

问题


I'm not sure if i got the right concept.

I was told by people that

Boundary = View

Entity = Model

Control = Controller

however based on my knowledge of MVC. (fat model, thin controller)

Isn't the Boundary = Controller, Control = Model (the busienss logic) and Entity = Model (The orm classes or similar entity classes which does only crud ).

I may be wrong, please guide me!


回答1:


Actually your first definition is simply correct. The meaning of words is sometimes confusing. The following link confirms and summarizes both patterns (naming ECB a variant of MVC): The Entity-Control-Boundary Pattern




回答2:


The two are very similar. The main difference is that MVC is typically used in user interface design whereas ECB is most often used in business logic. Here's a portion of a presentation by Adam Bien, who is known for promoting ECB, that helped me understand the difference between the two.




回答3:


Your explanation is correct. But they are not similar. MVC is for user interaction. Business rules are not bound to users directly and even not I/O devices like the internet itself. The ECB pattern is used for separating business entities from the boundary (mvc framework, ORM's). Entities are business objects, they know nothing about databases, orm's. The control is not a controller like in MVC, it can be a Command which represents a use case. Only the Control may access the business entities. Business entities are a world of their own, completely isolated from the MVC layer. It can be a business framework with patterns, principles, types and separated layers of its own, that does not wish to interact with anything related to I/O.

We can combine MVC with ECB like this:

User <-> Controller [Boundary] <-> Control (use case) [Control] <-> Business entities [Entity] <-> Other business entities [Entity]



来源:https://stackoverflow.com/questions/32912341/entity-control-boundary-ecb-vs-model-view-controller-mvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!