There should be one obvious way to do it - CoR

Musab 2 lat temu Ostatnio zmodyfikowane przez Alex Shvets 2 lat temu 1

In Chair of Responsibility design pattern, you mentioned "The client may trigger any handler in the chain" and the nature of the chain is dynamic. Isn't it against the PEP 20 – The Zen of Python "There should be one-- and preferably only one --obvious way to do it". So I think this is a con of CoR.


You might be right about that! Moreover, I think most patterns violate some of his principles, for example:

Simple is better than complex.
Complex is better than complicated.

Still, for better or worse, the patterns are used universally and not just in the Python world.