P&P Summit Day Three: Patterns for Connected Systems
Next up for the day was Ted Neward to talk about Patterns for Connected Systems, or some core WCF patterns. His talk focued on what are the best practices in using WCF; however, since it’s new we don’t know what is best practice. So to look for best practices now he turns to J2EE to at least get some patterns and see if anything maps over well. He then goes through a couple of examples from the “Core J2EE Patterns” book to see if can be used for WCF patterns.
For a few minutes Ted reviews the fundamentals of WCF, or the ABCs…Address, Bindings and Contracts. If you want more information on this check out the .Net 3.0 site for WCF.
His first real point is that we have to do away with the idea of shared, distributed objects, but rather the idea of reduced coupling. This means you aren’t passing buisness objects across the wire, but messages about objects and data. This is very different from what Rocky Lhotka was stating earlier in the week where he believes business objects are definitely the way to go. There was actually some light banter between Ted and Rocky during the talk.
The first pattern he talks about the interceptor pattern (or Intercepting Filter) from the book. This pattern addresses the need to intercept and manipulate a request and a response before and after the request is processed. In WCF you would create what is termed as a Behavior. The behavior example he shows (from the WCF SDK where they do a parameter value check in a filter) is very code based, but you can apply it via a configuration file if you want.
The next pattern he talked about was a Context Object pattern, or you want to avoid using protocol-specific system information outside of its relevant content. Another way to say this is that we may have contextual context we want to have about our process, such as we have with the HTTPContext object. Within the WCF space this is exposed by several context objects, such as the server context and operation context.
The next pattern was Business Delegate pattern, or if you want to hide clients from the complexity of remote communication with business service components. This is abstracting the gathering of data from the business objects themselves and giving that role to a business delegate. This allows you to abstract away the manner in which the communication and requests are made. This always allows us to optimize the communication away as well as replace it if necessary.
The next pattern he refers to as the dark side: business objects. This pattern says you have a conceptual domain model with business logic and relationships. His big point with this is that you don’t want to use business objects to be part of the communication between systems since the view of that object can be different. Changes from one meaning of the object for one system means that the communication is broken. His view is that the business object should not be the contract, but rather the message is the contract. At this point Rocky agreed that business objects should not be passed between applications but his nit pick is that you are really passing data transport objects. Ted states that he completely agrees with the fact and they want to make it clear that you are not actually sending an object at all, but rather a message. It looks like an object because you get a proxy object when you gen the code. One of the attendees brings up the fact the P&P Web Service Software Factory pushes this idea of messages are moving across the wire rather than objects.
This was a very interactive session that I can’t really do justice for the information that was shared. It was interesting, but overall not one of the better talks of the day in my opinion. I think the idea of looking at the patterns that are best practices in other languages and spaces to deal with distributed systems is a good one and I’ll be doing that when I’m ready to start dealing with WCF.
As a side note Ted must prescribe to the notion that the GUI makes you weak. He navigated around his system completely using the DOS window. Nice that he knows how to move around that way, but during a presentation I’d rather not watch someone typing a bunch of cd commands.