Does anyone know of a name for this anti-pattern? ...
# random
d
Does anyone know of a name for this anti-pattern? I think of it as the “diamond call” anti-pattern but I don’t know if it has an official name. Basically the pattern is you have some kind of control statement that calls the same function with different parameters, then the called function does different behavior based on the parameters. Usually it appears in more complicated contexts than this example. The solution is to just call different functions rather than having to branch again in the called function.
m
A breach of the single responsibility principle?
But that would mean more than just that specific pattern though.
d
Yeah, it’s definitely at least that. I most frequently have seen it around event busses or observables where there’s some
BaseEvent
that’s been handled poorly.
r
I'd say this antipattern is called "event bus" 🧌
3