In this post, I will briefly explain Observer design pattern, its use cases and implementations for enterprise, Phone, and Windows store platforms.
Observer, introduced in the book named ‘Design Patterns: Elements of Reusable Object-Oriented Software’ by Gang of Four, is a behavioral design pattern that provides a loosely coupled messaging to one or many subscribers of a subject. It is also called Publish/Subscribe or Pub/Sub or PubSub, (no PS, taken already). Think about, a news feed (subject) and its readers (subscribers), when a new feed published (publisher), readers are notified automatically. Its advantages mainly:
This differs from request-response pattern as, by using the feed example above, a reader sends requests periodically (interval can vary – one second, minute, hour, day, etc. depending on the nature of the system) to news feeder service and the service responds back with a new feed if exist (or something else if no update) in a 1-1 relation.
Here are some of the APIs aligned with observer pattern that you can leverage in your solutions:
It is a push notification service used for disseminating tile updates (live tiles), toast, badge, and raw notifications to Windows (8.0+) clients. For further details please visit here
Very much like WNS, but targets Windows phones (7.1+). For further details, please visit here
For both WNS and MPNS, you can leverage Windows Azure Mobile Services (SaaS – Software as a Service) for sending notifications down to clients or you can use your own service publisher. Azure mobile services also serve other phone platforms iOS, Android, etc. Here is a diagram that shows steps for sending notifications from the publisher that is on premise (not Windows Azure mobile service) to Windows store and phone clients. (PCS: Platform Client Service, NPC: Notification Platform Client)
Figure #1: Conceptual Architecture for WNS and MPNS
It is really a great API for real-time web messaging. I am not going to repeat my self here. I have a post on this subject, please visit here - Use of SignalR for Real-Time Messaging on Windows RT Devices. It has now version 2.0 and back to asp.net site here
Figure #2: PubSub Conceptual Architecture of Service Bus for Windows Server
This post introduced Observer pattern which is one of the well known and commonly used design patterns in software engineering and its implementations in respect to Microsoft platforms (Windows Phone, Windows tablets/laptops and desktops). Those are WNS, MPNS, SignalR, Windows Azure Service Bus, and Service Bus for Windows server. Please note there might be other MS technologies, I have listed those that I have worked on only. Happy observing
Hi, Nice article with a good explanation of very usable pattern. More details on implementing Publish-Subscribe pattern can be located at [1]. Examples in this article are provided using WSO2 Enterprise Service bus [2] which supports in both windows and linux platforms. [1] https://docs.wso2.com/display/IntegrationPatterns/Publish-Subscribe+Channel [2] http://wso2.com/products/enterprise-service-bus/