Pluggability

Tom Morgan tmorgan at acm.org
Thu May 28 00:41:01 UTC 1998


I was rummaging around in the Morphic stuff, and it is plain that
there is going to be lots more pluggability in the interfaces.

The current Smalltalk idiom for such things is to specify a #symbol
to perform the plugged in action.

Before alot more pluggable this and thats are made, 
I was wondering if it is worthwhile to consider changing the idiom, to instead 
pass in a block to evaluate as the standard way of doing pluggability?

There are pluses and minuses to doing this, here is my list (with some
schizophrenic comments about my own list)

Blocks to evaluate are a good thing
-----------------------------------

-There may be no need to make a method to handle the pluggablity
 action, you can do what you need right in the block.

-(For pluggable actions that need to be fast) it is easier to
 imagine tuning up methods that have real 'static' sends in the
 pluggable block, rather than some scheme that makes 'perform'
 run fast.
  
 Objection:  most pluggable things don't need to 
             be fast.  
 Yeah but:   the pluggable action inside of things
             like sliders and drag 'n drop would 
             benefit from being fast.

-It would easier to capture other data to pass into the pluggable
 block.  The slider is an example, where the pluggable #symbol
 can be provided with a user defined argument array, in addition
 to the standard slider supplied argument.

-It would be easy and 'thin' to provide an interface that accepted
 the #symbol kind of pluggablity, by simply sticking the 
 symbol in a block to evaluate and passing that to the block
 argument interface.

-This would be familiar to the Java crowd. (Don't throw rotten
 fruit at me, please)

-(This is a pretty opaque argument).  Using a block is a better
 match of the moment in time when you know something to the 
 moment in time you want to use what you know.  That is, 
 'performing' something is a good match, when you don't know
 at the calling point what you want until just the instant before you 
 do the perform;  the passed in block matches the fact that
 you know what you want to do at the time that you write the
 method which calls for the opening of the pluggable action.

 Objection:  What did you just say?

Blocks to evaluate are a bad thing
----------------------------------

-Anonymous chunks of code are scary and hard to debug.

-The blocks will be hard to track down and revise, in the
 event they need to be changed; it is better to insist that
 they be in named methods

Comments?
 
-- 
+---Tom Morgan ------------------------------ (tmorgan at acm.org) -----+
I   Brooklyn Union                          Phone: 1 718 403 2427    I
I   1 MetroTech Center                      Fax:   1 718 488 1752    I
+---Brooklyn, New York 11201 USA ------------------------------------+





More information about the Squeak-dev mailing list