I swear, everytime I lookup something in my C# book it makes me want to throw up. Considering Dijkstra's recent passing I thought this was especially relevant.
" read in a value;
while value != Sentinel do begin
process the value;
read in a value
end;
Unfortunately, this approach has two serious drawbacks. First, it requires two copies of the statements required to read the input value. Duplication of code presents a serious maintenance problem, because subsequent edits to one set of statements may not always be made to the other. The second drawback is that the order of operations in the loop is not the one that most people would expect."
Generally, the way around this is to have the "read in a value" inside the "while" line or if it's too big put it in a method and call that. And don't get me started on callbacks, no checked exceptions and pointers in C#.
http://www.thecodechannel.com/docs/gotoRoberts.asp
No comments:
Post a Comment