<br><br><div class="gmail_quote">On Sun, Feb 19, 2012 at 07:30, Gary Baumgartner <span dir="ltr">&lt;<a href="mailto:gfb@cs.toronto.edu" target="_blank">gfb@cs.toronto.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


On Sat, Feb 18, 2012 at 09:02:41PM -0500, Stephen Bloch wrote:<br>
[...]<br>
&gt; I see a lot of my students doing this -- in whatever language -- because they think of Booleans as a way to decide which of two things to DO, rather than as legitimate values in their own right.  In fact, the whole world of expressions is a bit of a foreign country -- a sort of &quot;adjunct&quot; to the more-legitimate world of statements.<br>



&gt;<br>
&gt; if (blah == true) {<br>
&gt;    return true;<br>
&gt;    }<br>
&gt; else {<br>
&gt;   return false;<br>
&gt;   }<br></blockquote><div><br></div><div>I too see this quite often (teaching PHP to non - CS/math freshmen, using === instead of == and trying to put types wherever possible), and it seems it&#39;s because I tell them something like &quot;the first arm of the if is executed if the test is true, otherwise the other arm is executed&quot;. So they want to have a comparison operator in the test.</div>

<div>But this year I insisted more on expressions and reduction to a resulting type and value, and when I see a student doing that I only need to tell him/her &quot;In fact the first arm is executed if the resulting value of the test is the value /true/, and the other arm is executed if the resulting value is the value /false/&quot; and s/he seem to be enlightened (sometimes it is still needed to say that the &quot;=== true&quot; part can thus be removed, but s/he then seem to understand and agree).</div>

<div>But I couldn&#39;t manage to make sure they understand this directly in the first place, and it seems that many students still need to go through the first notion (which might be simpler at first) and then go to the better definition. (Or I am doing things wrong?)</div>

<div>The previous years I was not insisting so much on reduction of expressions, and it was more difficult to make this notion clear.</div><div><br></div><div>Laurent</div><div>P.S. : It&#39;s great to know that other teachers have the same problems teaching programming languages. Is there a mailing list where such matters are discussed?</div>

<div><br></div><div><br></div><div> </div></div>