should the Observer Pattern include some infinite loop detection?

后端 未结 6 1991
我在风中等你
我在风中等你 2021-01-03 09:23

Quickly going through the GoF and the Head First Design Patterns book, it seems like there is no mentioning of infinite loop detection and handling for the Observer pattern?

6条回答
  •  渐次进展
    2021-01-03 09:45

    No. Any situation causing an infinite loop is obviously a sign of a bad design. I have never seen this happen by accident in the observer, and I don't see a need to write special cases for it in the observables.

    This is a case of Don't Do That Then.

提交回复
热议问题