I said earlier that I'd write something about protocol-oriented
Mon, 30 Aug 2004 14:09:09 +0000
I said earlier that I'd write something about protocol-oriented programming. Then I decided that it'd be more fun to send it to ll1-discuss instead of posting it here. In the process of penning it, I came across this article by Mikel Evins, which (a) says everything I wanted to, and (b) more, and (c) was written more than ten years ago, so decided I didn't need to.
I'm going to add my 2p summary anyway, based on the previous #lisp discussion that also led to Christophe Rhodes' LSM2004 presentation: a protocol is an defined communication across an ownership boundary, in which both sides have expectations of the other. This "equal peers" clause is what sets it apart from an API, in which the expectation may all be one-directional. Trivial example: consider the unix sync() call - the client doesn't have to do a whole lot, but the requirement on the implementation is strong. Conversely, in qsort(), where the client provides the comparison routine, both sides have something important to do if the job is to get done.
(Of course, simply having used a protocol somewhere doesn't mean you're thinking in a Protocol-Oriented manner any more than having used a function somewhere means you're programming Functionally. Some languages have better support than others for different ways of thinking. Your Mileage May Vary. There Is No Silver Bullet. Objects In The Rear View Mirror etc etc)
For other stuff about protocols (and especially stuff that predates the current flurry), Google Groups might be a good place to start. Here's an article by Scott McKay to be getting on with. Lots of protocol discussion hapened in comp.lang.dylan too, unsurprisingly.