Inheritance vs enum properties in the domain model

后端 未结 6 1029
予麋鹿
予麋鹿 2020-12-13 09:07

I had a discussion at work regarding \"Inheritance in domain model is complicating developers life\". I\'m an OO programmer so I started to look for arguments that having in

6条回答
  •  死守一世寂寞
    2020-12-13 09:41

    Both solutions are right. You should look which techniques applies better to you problem.

    If your program uses few different objects, and doesn't add new classes, its better to stay with enumerations.

    But if you program uses a lot of different objects (different classes), and may add new classes, in the future, better try the inheritance way.

提交回复
热议问题