I'm reading "Smalltalk Best Practice Patterns". The pattern "Indented
Control Flow" recommends putting each keyword on a separated line, indented with a tab. I like that for long messages, but this one example annoys me. array at: 5 put: #abc Earlier the author explains the how conserving vertical space increases readability. This example contradicts that advice. Also, it just seem so verbose compared to the Java equivalent of "array[5] = "abc";". Do experienced Smalltalkers really like this formatting for short messages like at:put: or is the following preferred? array at:5 put: #abc --- Mark Volkmann _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
I don't think the Beck formatting patterns are perfect, but I use them
because they are very good and very simple. That seems consistent with the design of the Smalltalk language, which values simplicity and consistency over exceptions (for example, the lack of special precedence rules even for mathematical message sends). On Sun, Nov 2, 2008 at 8:27 AM, Mark Volkmann <[hidden email]> wrote: > I'm reading "Smalltalk Best Practice Patterns". The pattern "Indented > Control Flow" recommends putting each keyword on a separated line, indented > with a tab. I like that for long messages, but this one example annoys me. > > array > at: 5 > put: #abc > > Earlier the author explains the how conserving vertical space increases > readability. This example contradicts that advice. > Also, it just seem so verbose compared to the Java equivalent of "array[5] = > "abc";". > > Do experienced Smalltalkers really like this formatting for short messages > like at:put: or is the following preferred? > > array at:5 put: #abc > > --- > Mark Volkmann > > > > > _______________________________________________ > Beginners mailing list > [hidden email] > http://lists.squeakfoundation.org/mailman/listinfo/beginners > Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
In reply to this post by Mark Volkmann
On Nov 2, 2008, at 9:27 AM, Mark Volkmann wrote: > I'm reading "Smalltalk Best Practice Patterns". The pattern > "Indented Control Flow" recommends putting each keyword on a > separated line, indented with a tab. I like that for long messages, > but this one example annoys me. > > array > at: 5 > put: #abc > > Earlier the author explains the how conserving vertical space > increases readability. This example contradicts that advice. > Also, it just seem so verbose compared to the Java equivalent of > "array[5] = "abc";". > > Do experienced Smalltalkers really like this formatting for short > messages like at:put: or is the following preferred? > > array at:5 put: #abc I normally use the separate-line version, just because I find it easier to follow the same formatting nearly everywhere. I remember someone (Beck?) giving similar reasoning somewhere about using "each" as a loop variable, or "i" as a loop index - nothing to think about, and you can recognize what's going on anywhere at a glance. I do occasionally "break" this rule, though. For example, to:do: comes to mind - I'll usually write 1 to: 15 do: [:i | "..." "..."] instead of 1 to: 15 do: [:i | "..." "..."] Hope this helps, Ben Schroeder _______________________________________________ Beginners mailing list [hidden email] http://lists.squeakfoundation.org/mailman/listinfo/beginners |
Free forum by Nabble | Edit this page |