Squeak programming question

Markus Kohler markus_kohler at hp.com
Mon Mar 22 13:17:14 UTC 1999


Ivan Tomek wrote:
> 
> See my earlier proposal to add a pseudovariable to refer to the
> caller.
> You could then do
> 
> ...
> caller setter1: object1
> caller setter2: object2
> ...

Yes you could. In some cases it might be nice to be able to do that. 

But if the two objects are really so closely related it's probably a
good thing
from a design point of view to put them together by creating a new class
that acts as a container.  
IMHO It's a good rule of thumb that if you use more than one object
always to together with
some other object, then it's time to create a new object that acts as a
container for those objects. 

Markus

> 
> Date forwarded:         22 Mar 1999 12:49:43 -0000
> From:                   kpgrant at mindspring.com
> Date sent:              Mon, 22 Mar 1999 07:49:22 -0500 (EST)
> To:                     squeak at cs.uiuc.edu
> Send reply to:          kpgrant at mindspring.com
> Subject:                Squeak programming question
> Forwarded by:           squeak at cs.uiuc.edu
> 
> > Quick programming question from a Squeak/Smalltalk newbie:
> >
> > Is there any elegant method for handling occasions when you
> > wish a method to return multiple objects?  I'm writing a
> > method that will return a set and a dictionary to the
> > caller.  I can't reasonably break up the method into two
> > methods (one for each kind of data), and the contents of
> > the set and dictionary are unrelated enough that it seems
> > silly to make a whole new class of object containing nothing
> > but pointers to each.  The only thing that occurs to me is
> > something like:
> >
> > ^((OrderedCollection new) add: myDictionary add: mySet)
> >
> > and then disassemble the thing on the receiving side.  I'm
> > not really crazy about this though.
> >
> > Re the discussion about turning this mailing list into a
> > newsgroup.  At the very least it would be nice if the
> > mailing list were split up into sub-lists based on topic.
> > There is a lot of traffic on the list that people like me,
> > who aren't far enough along to even think about making
> > improvements to the current environment, can't begin to
> > follow.  At the same time it seems kind of silly to post
> > a "how do I do this in Squeak" kind of question to the
> > whole list.  A sub-list dedicated to programming questions
> > would be nice.
> >
> > Thanks,
> > Kevin
> >
> >
> 
> Ivan Tomek,
> 
> Jodrey School of Computer Science
> Acadia University
> Nova Scotia, Canada
> 
> fax: (902) 585-1067
> voice: (902) 585-1467
> 
> Life would be so much easier if we could just look at the source code.
> 
> Elegance: The Mona Lisa has it, and so does the binary search algorithm. The Golden Gate
>       Bridge has it, as do the World Wide Web, Visicalc, Smalltalk and the U.S. Constitution.
>                  Public-key cryptography and Michelangelo's Pieta also have it."
>                                  - Gary H. Anthes , Computer World
> 
>  "Beauty is more important in computing than anywhere else in technology because software is so
>                 complicated. Beauty is the ultimate defense against complexity."
>                       - David Gelernter, Professor of Computer Science, Yale University.

-- 
Markus Kohler  mailto:markus_kohler at hp.com





More information about the Squeak-dev mailing list