DEV Community

Discussion on: The 7 most important software design patterns

Collapse
 
anpos231 profile image
anpos231

Keep in mind that Singletons and Observers are considered anti-patterns!

Collapse
 
ccunnin297 profile image
Cole Cunningham

I've heard of singletons as anti-patterns, but observer as anti-pattern is new to me. Would you mind elaborating?

Collapse
 
wengelef profile image
Florian Wengelewski

Maybe he means Event Bus systems

Thread Thread
 
anpos231 profile image
anpos231

You are right, I was thinking what I just write, and seems like I got it wrong. The observer I had in mind was the observer you can find in Magento for example (Magento 2 docs)

Event Bus is bad,
Observer pattern is not.

Thread Thread
 
ewertonazevedo profile image
Ewerton Azevedo

I dont get why Event Bus is bad.

Collapse
 
malisbad profile image
Matt Williams

I think it's more like "can be" anti-patterns.

Collapse
 
themobiledev profile image
Chris McKay

I've never heard of Observer being an anti-pattern. If anything, it usually comes highly recommended in enterprise-level software as a way to reduce tight coupling between components.

I know that singleton is considered an anti-pattern, but on some smaller systems where dependency injection isn't available, it sure is useful.