Newbie Question Re: Prototypes
Ken Dickey
kend at apple.com
Wed Feb 25 19:27:52 UTC 1998
>What are prototypes and how would they be used in Squeak?
There are a number of object models. Smalltalk has a "class-instance"
model, which means that one creates a class (object) which has the shared
code (methods) and meta-data (e.g. instance slot information) used to
"create instances of the class". You have to create a class before
making an instance (object).
In a Prototype based OO system, objects are thought of as having both
state (instance variables) AND behavior (methods). When you want to
create a 'child' of an object you can clone it and then change both its
state and behavior without modifying its 'parent'. Depending on the OO
model, changes to the 'parent' may or may not show up in the 'child'. In
a "pure" Prototype model changes to the 'parent' do NOT show up in the
child. In practice one may allow a user to have either behavior as
desired.
What is this other model good for? It has been used to advantage in
multimedia authoring where there are a lot of idiosyncratic objects.
When you want to create a singleton object, why should you have to create
a separate class?
Apple had a long-running multi-media authoring project called 'SK8'
(pronounced 'skate') which looked at a lot of user/developers to see how
people worked and thought about authoring. They ended up with a very
interesting Prototype model. A problem with the current Squeak
environment is that when a new user appears, he/she is essentially told
"go learn the class libraries and then you can build something". With
SK8, one gets a bunch of tool pallets and can do "drag 'n drop"
authoring. I.e. grab and plunk down media and then "shift-click" on the
visual elements to see/change their property sheet and add behaviors.
There is also an "English-like" language which is fairly intuitive.
E.g.
on MouseDown of me
set my fillColor to Green
play pingSound
set my fillColor to Red
tell CharlieRectangle to play myQuickTimeMovie
end
set the fillColor of every Rectangle on the Stage to mySpecialRenderer
See:
http://sk8.research.apple.com/sk8/sk8.html
Note especially:
http://sk8.research.apple.com/sk8/editors.html
Unfortunately, SK8 only runs on Macs. I am certainly interested (as I
suspect are others) in using Squeak to build a SK8-like development
environment and Prototypes would be a big help. Now as soon as Squeak &
Morphics get a bit more stable..
Cheers,
-Ken
More information about the Squeak-dev
mailing list
|