DEV Community

Discussion on: The Observer Pattern: A Solution for Subscription-Reliant Applications

Collapse
 
artlee06 profile image
Arthur Lee Ying Kiu

Hi there! Great job with this post! I really liked how you used an analogy at the start with the restaurant and the buzzer to explain the observer pattern as it has a direct mapping with how the observer pattern actually works. I also really liked how you related the pattern to your previous internship at NinjaVan doing Android development.

The content and flow is quite complete, perhaps since you have a section that says "When Do We Use the Observer Pattern?", it would be beneficial to have a section called "When not to use the observer pattern" that has specific examples of when this pattern would not be useful or even be a detriment to the software being developed.

Upon looking closer, I realised that reactiveX that you mentioned provides API for async programming with observables also works with RxJs. This relates to my previous internship at StaffAny where we used redux-observable which is an RxJS based middleware for redux. It allowed us to create side effects on our frontend based on specific responses received from our backend API calls. It uses Epics to listen for specific actions and trigger side effects written in the main logic of the pic. This allows us to do fancier interactions based on the backend response, such as making different modals open or close with a time delay based on the backend response as a side-effect to the main interaction.

Overall great job! Your post helped to solidify my understanding of such a pattern and relate it to my own experiences as well.