Yes or no: Should models in MVC contain application logic?

后端 未结 6 950
礼貌的吻别
礼貌的吻别 2020-12-23 09:54

Yesterday I had some discussion with one of our developers regarding MVC, more precisely about the role of the model component in MVC.

In my opinion, a model should

6条回答
  •  轮回少年
    2020-12-23 10:36

    Yes. It should. You are talking about Domain Driven Design.

    https://en.wikipedia.org/wiki/Domain-driven_design

    If you feel, you are not doing that then you are doing Anaemic Domain Model Design. that is an Anti Pattern.

    I read through an article from Martin Flower on how bad the Anaemic Domain Design is. https://martinfowler.com/bliki/AnemicDomainModel.html

提交回复
热议问题