tag:blogger.com,1999:blog-18677687.post7633716322994681363..comments2024-03-27T15:13:24.764-04:00Comments on Computer Science Teacher: A Loop By Any Other NameAlfred Thompsonhttp://www.blogger.com/profile/05575057876858763822noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-18677687.post-13599437238402760302019-10-29T12:07:53.265-04:002019-10-29T12:07:53.265-04:00Since I know several languages poorly I cannot go ...Since I know several languages poorly I cannot go wrong!Garthnoreply@blogger.comtag:blogger.com,1999:blog-18677687.post-41597679302212160452019-10-28T12:12:29.862-04:002019-10-28T12:12:29.862-04:00Mike, one thing those examples suggest is idiom in...Mike, one thing those examples suggest is idiom in programming languages. I remember the old joke that a good FORTRAN programmer can write a good FORTRAN program in any language. That attitude prevents people from getting the most out of a new programming language. Alfred Thompsonhttps://www.blogger.com/profile/08860483284747770757noreply@blogger.comtag:blogger.com,1999:blog-18677687.post-24021984878208551862019-10-27T08:52:49.277-04:002019-10-27T08:52:49.277-04:00I think it's worth noting that teachers, depen...I think it's worth noting that teachers, depending on language, can approach loops in two very different ways:<br /><br />1.. Counting loops - while of C/Java for - where the programmer manually controls some variable's value until it reaches an exit condition<br /><br />and <br /><br />2. a "foreach" loop that iterates over some list type structure<br /><br /><br />The former is probably more natural when teaching a language like Java and the latter maybe in a Python based class.<br /><br /><br />While they can frequently accomplish the same things, they are conceptually very different:<br /><br />result = ""<br />for i in range(len(s)):<br /> result = result + s[i].uppper()<br /><br />vs.<br /><br />result = ""<br />foreach i in s:<br /> result = result + i.upper()<br /><br />Both loop turn build a string that is the upper case of the original but the former is much more "low level" indexing into the String structure while the former operating at a higher level.<br /><br />Just some food for additional thought.<br />Mike Zamanskyhttps://www.blogger.com/profile/15069276938781711576noreply@blogger.comtag:blogger.com,1999:blog-18677687.post-50918153612926949612019-10-26T17:31:37.394-04:002019-10-26T17:31:37.394-04:00I find that a lot of students have a narrow view. ...I find that a lot of students have a narrow view. They look to solve only the problem in from of them and don't seem that interest is seeing reusable patterns. They also tend not to put diverse concepts together. I sometimes think that if I didn't make such a big thing of loops and arrays (or other iterative structures) they wouldn't necessarily put the two together. I think it may be related to how much we teach so many things in "silos" that are devoid of interaction with other concepts.Alfred C Thompson IIhttps://www.blogger.com/profile/06011086242006020298noreply@blogger.comtag:blogger.com,1999:blog-18677687.post-92112674341543475212019-10-26T15:58:42.272-04:002019-10-26T15:58:42.272-04:00Of course it is better to teach concepts - it give...Of course it is better to teach concepts - it gives the student a wider scope for understanding the context of something. However, I teach computing to secondary students. I try to give them as wide a context as possible in all aspects of the curriculum. But when it comes to programming, I rarely find any comments in their notes that show they have taken on board the wider context. Perhaps it is better with university students, but at secondary level the ideas they have seem to shrink away from taking on board the wider ideas that relate to a concept. For example, we teach Python. But where I give examples of how other languages do things, the students never write those references or ideas down. They seem to only want to know how Python works and nothing else.Netkonnexionhttps://www.blogger.com/profile/12979569303631105505noreply@blogger.comtag:blogger.com,1999:blog-18677687.post-67378622257752316222019-10-26T09:57:58.447-04:002019-10-26T09:57:58.447-04:00When teaching loops, I usually begin with "SE...When teaching loops, I usually begin with "SET, TEST, CHANGE" and talk about the role of the loop control variable. Usually we have to set (initialize) it, test it for continuing or stopping ( depending on the loop and finally being sure that it changes to avoid an infinite loop. <br />Anonymoushttps://www.blogger.com/profile/09193504037106258378noreply@blogger.com