How does a newbie get past the feeling thay he is trying to
understand an elephant whilst looking through a keyhole?
Dan Shafer
dan at shafermedia.com
Wed May 10 21:57:05 UTC 2006
Chris....
Thanks for the great feedback. Glad you found the post interesting.
I did in fact overcome all of this. I am re-emerging into the world
of Squeak/Smalltalk with tentative steps these days as I evaluate it
vs. PythonCard as my next development tool of choice. You can follow
my thinking and my progress in bits and pieces on my blog if you're
so inclined (http://www.danshafer.com/onemind). I was recording here
my very early experiences and fears; they are long since dismissed
and I find that I now have a proliferation of images containing all
sorts of stuff and experiments. Playing God in the Image is certainly
fun. (An aside: I'm a spiritual teacher and writer by profession, so
I couldn't help but turn your note into a little saying. "The Bible
tells us we are made in the image and likeness of God. In Smalltalk,
your image is created by a likeness of God." FWIW.)
On May 8, 2006, at 2:30 PM, Chris Muller wrote:
> Nice post Dan,
> <snip>
>
> Well, I think "familiar" is the key word here, because this is
> indeed a
> cakewalk in Smalltalk too:
>
> "print it"
> String streamContents:
> [ : stream |
> (1 to: 10) collect:
> [ : n |
> stream cr.
> 1 to: 3 do:
> [ : exp |
> stream
> tab;
> print: (n raisedTo: exp) ] ] ]
>
>
> Coding time: 2 minutes. I doubt I could do it in Pascal in < 10
> minutes though. It's just familiarity, thats all.
>
>> Five
>> minutes after I opened and installed Basic, I had it working. Pascal
>> took longer but that was because the install took longer and I had to
>> learn about compilation. I could not get it to run in Smalltalk/V to
>> save my gluteus maximus. I can't now remember all the gyrations I
>> went through before I finally threw up my hands and asked for help.
>
> When looking at the simple code above, what do you think is the reason
> it eluded you so?
Well, your result is nothing like I ended up with; you found a much
more elegant solution (iterating over the exp for example). But note
that to create that code I'd have to know about the class String,
streams, collect: (a powerful but really new concept) and the
raisedTo: method. Not hard stuff, of course, but, as you properly
say, it's a question of familiarity and only that.
In Basic, it's something like:
repeat with i = 1 to 10
print i; i*i, i*i*i
end repeat
Essentially the same in Pascal. But note that the "print" statement
just prints stuff in a predictable place. When I solved the problem
in Smalltalk, I ended up believing that I needed to use the
Transcript for output, which involved figuring out how to get one to
open and print stuff.
Also, I should note that this was my first attempted program out of
the box without reading any docs. That's how I'd done it in Basic and
Pascal, so I expected a similar result form Smalltalk. It was my
familiarity with other environments and my inaccurate expectation at
work. But I suspect a LOT of folks who encounter Smalltalk do so with
a similar mind set and walk away bewildered.
Dan
More information about the Squeak-dev
mailing list
|