Newsgroups: comp.lang.scheme
Path: cantaloupe.srv.cs.cmu.edu!rochester!udel!news.mathworks.com!tank.news.pipex.net!pipex!oleane!jussieu.fr!news-rocq.inria.fr!news2.EUnet.fr!news.fnet.fr!ilog!news
From: davis@ilog.fr (Harley Davis)
Subject: Re: FADQ (Frequently Asked Dumb Question): what's a MOP?
In-Reply-To: bh@anarres.CS.Berkeley.EDU's message of 22 Aug 1995 14:53:23 GMT
Message-ID: <DAVIS.95Aug22193154@halles.ilog.fr>
Lines: 69
Sender: news@ilog.fr
Nntp-Posting-Host: halles
Organization: Ilog SA, Gentilly, France
References: <410778$hic@emf.emf.net> <412cbd$88t@louie.disney.com>
	<tonyk-2208950850030001@dial1-3.cybercom.net>
	<41cr13$d32@agate.berkeley.edu>
Date: 22 Aug 1995 17:31:52 GMT


In article <41cr13$d32@agate.berkeley.edu> bh@anarres.CS.Berkeley.EDU (Brian Harvey) writes:

> tonyk@cybercom.net (Antoun Kanawati) writes:
> >A MOP is a notation, potentially executable, that allows the programmer to
> >define an object model and its algorithms.  MOPs are used to define message
> >dispatch algorithms, inheritance semantics, delegation semantics, method
> >and instance variable access, and all the other details that define the
> >behavior of an object programming model.
> 
> This, while true, may not be quite enough for someone who hasn't seen the
> idea before to understand what it's *for*.  So at the risk of embarrassing
> mistakes, let me try to add something:
> 
> Object-oriented programming is an abstraction technique.  That is, the user
> of an object class knows only how it behaves and not how it's implemented.
> Like any form of abstraction, this makes for more elegant programs, but
> sometimes at an efficiency cost, because the user of the abstraction knows
> some special thing about the immediate problem at hand that makes it
> different from the more general category of problems that the abstraction
> was meant to solve.  (A prototypical example is that you want to sort some
> data and you know that they are already *almost* in order.  Another is that
> you know that a particular matrix is sparse.)  So in order to make your
> program run fast, you give up on the abstraction and write an old-fashioned
> program without levels of abstraction.
> 
> Instead of that, the MOP lets you write the elegant, understandable program
> and separately "tell the class" about what makes your problem special, e.g.,
> "use insertion sort instead of quicksort because these data are almost
> in order."  That is, you can customize the class's methods for this
> instance. 

I think most real uses of MOPs provide more general facilities not in
the base language.  Using the MOP casually for specific programs is
generally not done since a MOP is complicated and hard to get right;
most programmers do better by writing something less elegant and more
special purpose.

In Ilog Talk, we or our clients have used the MOP for cleanly and
orthogonally introducing the following facilities in add-on libraries:

 * Multiple inheritance. (The base language uses single inheritance.)
 * Representing C++ objects in Lisp with slots, etc.
 * C++-style method dispatch to exactly simulate C++ function
   overloading in Lisp.
 * Shared slots.
 * Dynamically addable slots.
 * Objects whose slots are mapped to keyword values in files.
 * Persistant objects.
 * Undoable slot modifications for backtracking through multiple worlds.
 * Multiple-valued slots.
 * Type-checked slots.
 * Demons fired on slot access.

So these are the kinds of things we mean when we say that a MOP lets
you tweak the object system itself.

-- Harley Davis

PS For more information about Ilog Talk, you can visit our Web server
at http://www.ilog.com/ or send mail to info@ilog.com.
-- 

-------------------++** Ilog has moved! **++----------------------------
Harley Davis                            net: davis@ilog.fr
Ilog S.A.                               tel: +33 1 49 08 35 00
9, rue de Verdun, BP 85                 fax: +33 1 49 08 35 10
94253 Gentilly Cedex, France            url: http://www.ilog.com/

