[Newbies] Spaghetti code

Herbert König herbertkoenig at gmx.net
Sun Feb 18 10:48:46 UTC 2007


Hello Blake,

B> Looking at the chart, it looks like spaghetti code, and reminds me of some
B> of the stuff I did in BASIC. And that's sort of what he's doing within
B> Smalltalk. I'm actually tempted to show him how it would look in BASIC
B> using GOTOs and line numbers. It would have the advantage of being easy to
B> see all in one glance.
for things I would have considered a state machine in previous
languages in Squeak I usually take a Dictionary.

I've only used them two levels deep up to now and for a real deep tree
it's not appropriate.

But they are easy to follow by opening explorers on them and
programming consists of going to the right dictionary typing:

self at: "I now want to handle this case" put: [ the Block of code to
handle this].

Lately I put these Dictionaries into class vars and on the class side
I have some file in/ out code using reference streams. (Tried this
only with Dictionaries containing no code, but I guess it should work
with blocks too.)

Cheers,

Herbert                            mailto:herbertkoenig at gmx.net



More information about the Beginners mailing list