From ... Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-hub.siol.net!npeer.kpnqwest.net!nreader1.kpnqwest.net.POSTED!not-for-mail Newsgroups: comp.lang.lisp Subject: Re: Protocols? WAS: Why Arc isn't especially OO References: <87667cpcqs.fsf@teonanacatl.andreas.org> Mail-Copies-To: never From: Erik Naggum Message-ID: <3217374073660749@naggum.net> Organization: Naggum Software, Oslo, Norway Lines: 50 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 15 Dec 2001 03:01:16 GMT X-Complaints-To: newsmaster@KPNQwest.no X-Trace: nreader1.kpnqwest.net 1008385276 193.71.66.49 (Sat, 15 Dec 2001 04:01:16 MET) NNTP-Posting-Date: Sat, 15 Dec 2001 04:01:16 MET Xref: archiver1.google.com comp.lang.lisp:22454 * Nils Goesche | I know (parts of) Java, C++ and CLOS; but could somebody be so kind | and enlighten me about what ``protocol'' means in this context (or | MOP)? I always thought a protocol is something like Q.931 or X.75 :-) Those are _communications_ protocol specifications. There are many kinds of protocols, but they are all concerned with distributed synchronized state transition and context-dependent information exchange. The reasons for specifying communications protocols with such heavy-handed machinery are (1) that there is high value in conserving bandwidth, and (2) that they must be implementable as completely separate projects. This is not different from specifying functions and data types and state transitions in a single software project. For instance, you can only call read-line on an open character stream, you can call close only on an open stream, etc. These specifications are entirely equivalent to what you must do in a communications protocol. In essence, a remote communications peer may be regarded as an "object" to which one sends "messages" in order to influence or interrogate its state. The "information hiding" aspect of some object-oriented models acutely parallels the design of communicating peers, about which one should not know too much and really not force to change state outside of the protocol. What an object or module or whatever exports may be seen as the elements of its (interaction) protocol. The distinction between a protocol and an API is that the protocol will make states and state transitions explicit, while they are usually hidden in commentaries and error conditions in API. Something designed and implemented as a _protocol_ will usually be much more orderly, simply because the number of states and state transitions are reduced when they are made explicit and visible to the programmer. E.g., global variables scare many programmers because one may change the state of the whole system so easily and it is so hard to restore state. A global variable is hard to model accurately, but this is in sharp contrast to the special variable, which may be regarded as arguments to the functions called inside their bindings, each function propagating the entire set of global bindings in effect when the call is made and models their unbinding accurately. However, most protocols that invent variable exchange fail to implement nesting behavior properly. In fact, nesting and recursion appear to be uncommon in protocols designed by people who prefer a "flat" state space. Numerous programming techniques would be so much more _conscious_ if they were designed as parts of protocols. /// -- The past is not more important than the future, despite what your culture has taught you. Your future observations, conclusions, and beliefs are more important to you than those in your past ever will be. The world is changing so fast the balance between the past and the future has shifted.