[Newbies] Smalltalk is a Mystery to Me

Randal L. Schwartz merlyn at stonehenge.com
Sat Aug 23 11:44:54 UTC 2008


>>>>> "Todd" == Todd Blanchard <tblanchard at mac.com> writes:

Todd> And I'd guess you just totally blew the newbies input buffer with
Todd> conceptual overload when he was just trying to get one thing working.

I'm of the belief that you don't show people bad style, no matter what their
level, and especially newbies, because they tend to fall back on what they
learn first.  Perhaps we differ in our experience, but I have plenty of
experience of this from my Perl course presentations.

At a minimum, you say "an experienced user would probably have put
these into a Collection, and you'll want to learn about those pretty
soon, as nearly every class uses a Collection of some kind."

Using separate variables in place of a collection often leads to mindless
cut-and-paste-and-slightly-edit code replication, and/or people asking "how do
I turn a string into a variable name".  Again, from experience.  These are not
behaviors you want to encourage in a newbie. :)

Admittedly, I should have done something less Smalltalk idiomatic:

hands := IdentityDictionary new.
hands at: #north put: Set new.
hands at: #east put: Set new.
hands at: #west put: Set new.
hands at: #south put: Set new.
hands at: #trick put: Set new.

Eventually, the newbie can learn that the cut-n-paste-and-slightly-edit that I
just did to make that can be replaced by a proper loop.  But at least that
cut/paste cycle won't be repeated everywhere else in the code.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion


More information about the Beginners mailing list