You got it .... let's discuss a bit more on design patterns here.....😁
For further actions, you may consider blocking this person and/or reporting abuse
You got it .... let's discuss a bit more on design patterns here.....😁
For further actions, you may consider blocking this person and/or reporting abuse
Walid LAGGOUNE -
Hanzla Baig -
Lakh Bawa -
Valeria -
Top comments (7)
I... Love the observer pattern.
I just find it so satisfying and elegant...
I don't use it with React because it's not needed, but with vanilla JavaScript when something needs an active "watcher" relationship to something else. Or in C# with events and delegates (which are basically the observer pattern).
Sidenote: I find it different to the pubsub pattern. For me pubsub is more like "I'll broadcast something and I don't care who is listening or why". Whereas observer seems like a more cohesive relationship to me. "This event is important, someone is exclusively interested. I'll notify them directly."
Cool
Null object is definitely really cool!
I usually try to avoid using too many patterns - they can be really handy in a pinch, but most of my projects are pretty small, so I usually just try to pay attention to SRP and make sure things are small and composable. I've been slowly adopting more functional patterns, too, and I find that helps simplify things quite a lot.
I suppose the big one I tend to use is the façade pattern (helps with SRP). Others I've used a fair bit are Observable, along with a slightly-modified Service Locator (to get rid of the need to cast the results).
That's nice
I haven't had much opportunity to use it, but I think the state pattern is really cool. Has anyone here ever used it?
Not me
My personal favourite is NULL PATTERN cause it saves me from writing extra code for handling exceptions and errors... What about u ?