How do you handle huge if-conditions?

后端 未结 21 1730
一向
一向 2021-01-31 17:14

It\'s something that\'s bugged me in every language I\'ve used, I have an if statement but the conditional part has so many checks that I have to split it over multiple lines, u

21条回答
  •  鱼传尺愫
    2021-01-31 17:48

    I'm surprised no one got this one yet. There's a refactoring specifically for this type of problem:

    http://www.refactoring.com/catalog/decomposeConditional.html

提交回复
热议问题