On 2010-05-11, Richard Heathfield <> wrote:
> Seebs wrote:
>> Having read posts by Mr. Nilges, why do you persist in using English, when
>> it is clearly a language which supports apallingly bad writing?
> Najlepszy punkt. Moja obrony jest fakt, ?e oprócz prawdopodobnie C, nie
> wiem równie? do?? wszelkich innych wersjach j?zykowych skutecznego
> porozumiewania si? w nich. Moje polskie, na przyk?ad, jest po prostu
> odmian?.
> [Tr: Excellent point. My defence is that, apart from perhaps C, I don't
> know any other languages well enough to communicate effectively in them.
> My Polish, for example, is simply ghastly.]
Heh.
> My apologies for the non-ASCII characters in my first paragraph, above.
No worries, they were deeply justified.
> The underlying source of that problem, as far as I can make out, is what
> I have seen described as the "pigeon-hole" approach to programming - the
> idea that a programmer's task is simply to put the right numbers in the
> right places at the right time, and that nothing else matters. Such a
> programming style used to be commonplace (see the story of Mel in TJF
> for a somewhat more positive slant on "pigeon-hole" programming). But,
> in my view, structure and abstraction provide real and lasting benefits
> for large, maintained programs.
Good point.
> Yes, it's a line, not a binary - to talk about "structured" vs
> "unstructured" code is to imagine a polarity that doesn't really exist
> in the real world. But I have found that leaning heavily towards the
> "structured" end of the line yields real benefits in clarity and
> therefore maintainability.
Yes. I'm just not entirely convinced that "structured" implies "single
exit". I think it might be better understood as implying "using structures
according to their design". Several scripting languages are built with
structures which, very much intentionally, rely on multiple exits and
other control features to provide terseness. Consider the Ruby idiom
for looping through a file:
file.each do |line|
next if line.match(/^#/)
# do stuff here
last if some_condition
end
There's no way to write this loop using a SEME model that's anywhere near
as legible or clear. The natural idiom of the language is built around
looping-over-a-whole-set, with the assumption that if you want to stop
earlier, it will.
> Sometimes it makes sense to stick to style rules even when departing
> from them would do no particular harm and might even do a little good;
> sticking to a known-good strategy means spending more time thinking
> about the problem domain and wasting less time on thinking about how to
> code it. (I know you won't draw the erroneous conclusion that I am
> advocating spending /no/ time on thinking about coding.)
That can be viable; it reminds me of Feynman's decision to always have
chocolate ice cream for dessert because it was never bad and it meant he
didn't have to spend time on the decision.
I tend to stick to style rules in cases where I think they might be
marginally worse, but as soon as the cost becomes prohibitive, the style
rule goes. Especially, I might add, if there's a conflict between
style rules -- that makes it easier to justify following a secondary rule.
-s
--
Copyright 2010, all wrongs reversed. Peter Seebach /
usenet-
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!