Recently I decided to start developing a client/service based system using WCF and a Duplex Channel (callbacks from Service to client). The clients will behave as “slaves”, that is, they will only connect to server and from then on, only the server communicates with them. Eventually the server may request that the clients send “data streams” to him (frequent updates of new content/objects).
I want to make my software as loosely coupled as possible, but even reading about the different patterns for this, such as MVC and MVP, they don’t seem to be designed to fulfill my specific requirements.
What is the best code architecture or pattern for my problem? Considering the technologies I am using?
3
Patterns Abstract Details, not Vice Versa
The clients will behave as “slaves”, that is, they will only connect to server and from then on, only the server communicates with them. Eventually the server may request that the clients send “data streams … MVC and MVP, … don’t seem to be designed to fulfill my specific requirements.”
I’m getting the feeling that you are trying to find a pattern that maps directly to your hardware/network setup. This is the antithesis of Object Oriented design patterns.
Software Systems are Organic Molecules of Patterns
As in chains of patterns. The high-level parts of M.V.P. are in turn their own complex Object Oriented structures as needed to represent nested abstract layers eventually getting to the servers. You’re missing all the design between the top layer MVC concept and the server – server communication.
Prototyping
Perhaps you should take a prototype mindset. As Fred Brooks said in the Mythical Man Month
“The management question, therefore, is not whether to build a pilot system and throw it away. You will do that. The only question is whether to plan in advance to build a throwaway, or to promise to deliver the throwaway to customers.”
I’m not suggesting you build an entire system; just enough to experiment with the architecture variations. You really need to understand where you’re going with this before you commit to delivery schedules.
As far as Ive been able tell MVP vs MVC is a matter of emphasis. MVP has a more intimate association between the V-and-C.
Following is a quote from MVP: Model-View-Presenter
The Taligent Programming Model for C++ and Java
…normalize the separation between the Model and the View-Controller, which we refer to as a Presentation. This represents the breaking down of a programming problem into two fundamental concepts: Data Management and User Interface.
I think it boils down to how one wants to model things. If MVC works in a given case does not mean MVP is wrong for that case.
Software design patterns are guidelines, not hard and fast literal rules to be followed to the exclusion of good design throughout your system.
MVC (MVP) and WCF Systhesis
MVC/P has become the go-to design paradigm for GUI applications so I would not get sidetracked because WCF based on Service Oriented Architecture (SOA).
As far as I can tell one can easily use the WCF .net framework within the Model-View-Whatever pattern.