request for critique
Boris Gaertner
Boris.Gaertner at gmx.net
Mon Jun 2 17:28:09 UTC 2003
David Faden <dfaden at iastate.edu>
> Hi,
>
> I'm interested in getting some comments on a bit of Smalltalk code. Am
> I missing or misapplying some of the common idioms? Comments on style
> (or correctness) would be very welcome too. My code is attached to the
> bottom of this message.
One little remark about method generateImage:
<code snip>
"Are morphs 0-indexed or 1-indexed? I'm assuming 1-indexed below."
1 to: self width do: [:x || b |
b := maxB.
1 to: self height do: [:y || iteration |
</code snip>
image is a form and form coordinates run from
0 to form width - 1 and from 0 to form height - 1.
So you should write:
0 to: self width: do: [ <...> ]
When you look very carefully (or use a magnifier program like FisheyeMorph
you see a one
pixel black border on the top and on the left of your morph. This is because
you started
with 1 and not with 0.
Otherwise your example is ok.
Nice work!
Boris
More information about the Squeak-dev
mailing list
|