What is the name of this bad practice / anti-pattern?

前端 未结 14 2108
独厮守ぢ
独厮守ぢ 2021-02-03 18:02

I\'m trying to explain to my team why this is bad practice, and am looking for an anti-pattern reference to help in my explanation. This is a very large enterprise app, so here

14条回答
  •  逝去的感伤
    2021-02-03 18:37

    It is just a bad code, it does not have a name for it (it doesn't even have an OO design). But the argument could be that the first code does not fallow Open Close Principle. What happens when list of supported things change? You have to rewrite the method you're using.

    But the same thing happens when you use the second code snippet. Lets say the supporting rule changes, you'd have to go to the each of the methods and rewrite them. I'd suggest you to have an abstract Support Class and pass different support rules when they change.

提交回复
热议问题