avoiding if statements

前端 未结 24 746
心在旅途
心在旅途 2021-01-30 08:39

I was thinking about object oriented design today, and I was wondering if you should avoid if statements. My thought is that in any case where you require an if statement you ca

24条回答
  •  深忆病人
    2021-01-30 09:18

    Creating a whole new class for an else, while technically doable, would likely result in code that is hard to read, maintain, or even prove correct.

提交回复
热议问题