Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news2.arglkargh.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: while loop condition doesn't work Date: Thu, 02 Feb 2017 10:01:55 -0800 Organization: None to speak of Lines: 72 Message-ID: References: <750784a4-22dc-44ef-8972-34d4fb048b00@googlegroups.com> <871svxdiu9.fsf@bsb.me.uk> <87pojhbw2h.fsf@bsb.me.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="523b5027be519a02b651eac1ee0346e8"; logging-data="28089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18JOoUVFkvevvlMDApnrvcG" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:xCztJ4GRkZpldxOjKHcw3PQudo0= sha1:JmqrjIfqZK43yAaGGecpi9kvg8Y= Xref: csiph.com comp.lang.c:102965 Tim Rentsch writes: > Keith Thompson writes: [...] >> I agree that there's a problem. I'm not sure eliminating such >> comments or moving them elsewhere is the best solution. > > How you phrase the statement shows how deep the problem is. My > suggestion is not to move /comments/ but to put /commentary/ > outside the program. Any program examples that have /comments/ > should have only those comments that one would write as part > of a real (as opposed to example or tutorial) program. In your opinion. > The > question of what is the best solution is misplaced: it assumes > we know exactly what problem we're trying to solve, that it is > well-defined, that there is a "best" solution (by what metric?), > and that we could tell whether a proposed solution is a best > solution. My goal is to avoid a behavior fairly well known to > have negative effects. It may be that in the process of doing > that there will be other unexpected effects, but the only way > to know what those might be is to try the suggestion and see > what happens. The goal is to present code to novice student programmers and explain to them what the constructs in it mean. Including comments explaining, for example, what "++" means is one solution to that problem. As discussed, that solution causes another problem, encouraging the inappropriate use of similar comments when the audience is not novice student programmers. I suggest that clearly marking such comments and explaining their purpose is one possible solution to that secondary problem. [...] >> Perhaps one could use some special marker, with a comment at the >> top (and an explanation by the instructor) saying that any marked >> comments are intended to explain the language features and should >> not be included in real code. >> >> int i; /* TUT: Create an object named "i" of type int */ >> i = 42; /* TUT: Assign the value 42 to i */ >> i ++; /* TUT: Increment i by 1 */ > > I've seen this done in other ways (eg, using a different font > for the non-code material). It suffers from many of the same > problems that regular comments do. Most importantly, it too > promotes or reinforces a way of thinking that is damaging to > less experienced programmers. In that respect it isn't really > an improvement over using regular "comments". It's specifically intended to emphasize the point that such comments are for exposition to inexperienced programmers, and that such comments should not be used when such programmers are not the intended audience. If you think it wouldn't work, that's fine; you may be right. >> (It's been a long time since I was a beginning programmer, so >> it's hard for me to tell what would work best.) > > The "what would work best" phrase tacitly implies that you > know what problem is being addressed. Can you say what problem > it is you're trying to solve here? See above. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"