Inheritance vs enum properties in the domain model

后端 未结 6 1028
予麋鹿
予麋鹿 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:24

    Most importantly OOPS means modeling reality. Inheritance gives you the opportunity to say Cat is an animal. Animal should not know if its a cat now shout it and then decide that it is suppose to Meow and not Bark, Encapsulation gets defeated there. Less code as now you do not have to do If else as you said.

提交回复
热议问题