Web Services Interfaces and Zero-One-Infinity Rule
I commented on Steve Vinoski’s blog:
Interfaces defining many kinds of messages imposes unnecessary coupling, when what is required is for documents to be thrown over the other side of the wall, leaving the other party to decide what order to parse and process the document.
To which Mark Baker posed:
So in the spirit of the Zero/One/Infinity rule, what is he saying? Is it a) services should not have interfaces, b) services should share a common interface, or c) services should have whatever interface they want?
My reply is: “I claim total ignorance of the Zero One Infinity rule” <wink>. By the way here’s a summary of the rule
A rule of thumb for software design, which instructs one to not place random limits on the number of instances of a given entity.
I’m struck by this apparent contradiction:
- as a programmer, I loath functions which have too many arguments since they make testing difficult, and are difficult to code to.
- Yet, with web services, I’m advocating a giant method which sends every parameter that is needed for the task to be completed, however many there may be.1
It boils down to this – metaphors are important. They define how we approach a subject. Documents are soft furry and small. Objects are slippery, slimy and have sharp teeth. Never mind that both are actually wild animals!
If web service is all about dealing with documents, it seems alright that we are dealing with 16 arguments. If a web service is about RPC, then 16 arguments feels onerous.
A doc-literal approach also guarantees us that we are dealing with a document, not a remote proxy. We are free to probe it, parse it and pull it apart knowing it’s just data2.
We also know that once the document is handed over, the customer isn’t going to suddenly say, “… wait and before you start…”, so both parties can have confidence that the entire context of the service is understood, or the state of the remote component is going to change.
1I suspect this difference is not that great in real life, as one would probably deal with relatively few structs which are marshalled across the wire
2when this data actually represents executable code, since it is a script that runs on your system
About this entry
You’re currently reading “ Web Services Interfaces and Zero-One-Infinity Rule ,” an entry on Chui's Counterpoint
- Published:
- 10.19.05 / 2pm
- Category:
- Thinking IT
4 Comments
Jump to comment form | comments rss [?] | trackback uri [?]