Occasionally Connected Systems Architecture: The Client
Messaging Provides the Solution
To prevent the background thread from blocking the UI thread for any significant period of time, it is important that it perform as few updates as possible. However, the amount of updates performed directly corresponds to the number of updates sent by the server; this number can be quite large when the client goes online again. How, then, can this be solved?
If the server were to package these updates in messages one at a time, as occurs in the online scenario, and these messages were to be stored until they could be forwarded when the client came online again, everything would just work. As each message would be received at the client, it would be quickly processed and any locks would be acquired and released before the user even noticed.
By building on the classic MVC and Service Agent patterns, and through intelligent use of messaging and the automatic synchronization facilities found in .NET, deadlocks and data races can be avoided in Smart Clients. Without any additional effort, a high-performance user experience is maintained even during resource-intensive synchronization with the server. In the next article in this series, you'll see the how GUIDs simplify the solution across multiple tiers.
- Model, View, Controller (Wikipedia): http://en.wikipedia.org/wiki/Model-view-controller
- Service Agent pattern: http://realsoa.blogspot.com/2005/05/service-agent.html
- NServiceBus, an open-source communications infrastructure that supports these patterns: http://www.NServiceBus.com
- Disconnected Problems and Solutions—a blog post: http://udidahan.weblogs.us/2007/03/30/entity-framework-disconnected-problems-solutions/
About the Author
Udi Dahan is The Software Simplist, a Microsoft Solutions Architect MVP, recognized .Net expert, and a member of both the Microsoft Architects and Technologists Councils. Udi provides clients all over the world with training, mentoring, and high-end architecture consulting services, specializing in Service-Oriented, scalable, and secure .NET architecture design and Web services.
He is a member of the International Speakers Bureau of INETA, an associate member of the International Association of Software Architects (IASA), a frequent conference presenter, a Dr. Dobb's sponsored expert on Web Services, SOA, & XML, and a regularly published author.
Udi can be contacted via his blog: www.UdiDahan.com.
Page 2 of 2