[1354] in java-interest
The need for "perform" in Java & instanc
daemon@ATHENA.MIT.EDU (John D. Mitchell)
Wed Aug 30 19:57:22 1995
Date: Wed, 30 Aug 1995 13:43:45 -0700
From: "John D. Mitchell" <johnm@emf2-003.emf.net>
To: mikec@metronet.com (Mike Christiansen)
Cc: java-interest@java.sun.com
In-Reply-To: <mikec.335.05030B40@metronet.com>
Mike Christiansen writes:
> (Sorry everyone about the last post of this message to the request
> address :< )
Well, that's certainly better than sending a few thousand people a "I vote
YES on comp.lang.java" message. :-)
> I see the need for smalltalk-like perform: and perform:with: operations.
> These are needed to implement several useful patterns which are found in
> ParcPlace Smalltalk and in the patterns book. For example, Adaptors map
> the methods value and value: to class specific methods and are used to
> map Views to Models in the MVC paradigm. ValueModel's are objects which
> hold onto a "value" and provide methods value and value: as "getter" and
> "setter" methods. Most of the Smalltalk widgets and other types of views
> expect that the model they are presenting will respond to ValueModel
> methods to provide a value to present. The Adaptor allows models which do
> not support this protocol to be presented by such views.
But is that last capability really necessary? If so, is it really
necessary often enough to make the benefit of such heavy weight constructs
as perform: and perform:with: outweigh their costs to the nice simple Java
that we know and love? I don't know.
A Java interface can be created for the 'ValueModel' protocol to allow for
that part of the MVC paradigm. Any classes which need to be used in an MVC
system implements that interface.
> In fact this begs the larger question of how instance specific behavior
> is to be implemented in Java. Each instance of an Adaptor is initialized
> with its model object and the symbol names of the methods used to
> accessthe model's value. Creating a new subclass of Adaptor for every
> neededpurpose would cause hundreds of classes to be created.
Have an "Adaptor" interface... That is, of course, a bassackwards approach
compared to Smalltalk.
I really love perform: & perform:with: in Smalltalk. They make for some
slick code. However, IMHO, they don't fit the more 'static' model of Java.
I not sure whether that's good or bad. Should Java become more dynamic
(in this sort of manner)?
Take care,
John
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com