Facade Pattern (Example)
This is derived from actual code of mine, and elements of this sample combine the Facade pattern with the Publisher (Observer) pattern. The primary class, based on the ISubscriber interface, is fairly complicated to use, requiring delegates, threading, and asynchronous callbacks. The facade, based on ISubscriberFacade, encapsulates all the methods required to work with the Windows Communication Foundation (WCF) service , handling threading, delegate creation, and asynchronous callbacks internally, so that that the clients only need to create the object. I wrote the encapsulating client to ease the adoption of the WCF service for legacy clients, seeing that the code complexity was likely a hurdle.
Reduces or hides complexities to other clients or systems
Simplified interaction between systems and/or types
DispatchingObservableCollection is based on ObservableCollection commonly used in Windows Presentation Foundation (WPF) applications and available here.
Some classes are not available in this example, i.e., TrackedConnections, CubeInfo, and ConfigurationList, since they are part of the larger project, and would detract from this example
Click the download button for ISubscriberFacade.cs...