Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I convince my co-programmers not to do paranoid "just to be sure programming"?
    text
    copied!<p>I've often found that when a programmer or the one assigning the task doesn't really understand how a solution could work, they kind of randomly add stuff until it works.</p> <p><strong>Examples:</strong></p> <p>Repainting a window which for some reason isn't painted as the programmer would like it:</p> <pre><code>Invalidate(); Revalidate(); ProcessMessages(); Update(); Repaint(); Repaint(); ProcessMessages(); Repaint(); </code></pre> <p>Over-cautiousness:</p> <pre><code>function test1(x: boolean) begin select case x true: // do something false: // do something else else raise Exception.Create("Invalid value.") // just to be sure end; end; function test2(x: Integer); var y: Integer; begin y = Abs(x); if y &gt;= 0 then begin // do something end; end; </code></pre> <p>Although especially the over-cautious coding practices lead to compiler warnings in most languages, I've actually seen all of the above in production code!</p> <p>In most cases this kind of coding is defended by the programmer and/or the boss. The reasons always come down to this response:</p> <ul> <li>Well, does it hurt if we double check? Better be safe than sorry!</li> <li>It's defensive programming, didn't they teach that at the university?!</li> </ul> <p>Unfortunately I'm out of good reasons not to do this, although I still believe this is really really bad style, which <em>can</em> have bad repercussions. </p> <p><strong>Are there hard facts I can present that this style has bad repercussions eventually?</strong></p> <p><strong>EDIT:</strong> Thank you for the good suggestions to get rid of this style. But I'm still interested in <strong>reasons</strong> I can present to my co-workers to explain and possibly convince them, <strong>why</strong> this is bad and it is in their best interest not do be paranoid.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload