<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title></title>
	<atom:link href="http://codeboom.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeboom.wordpress.com</link>
	<description>Exploring interesting ways of learning about Computer Science</description>
	<lastBuildDate>Tue, 21 Feb 2012 17:31:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='codeboom.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://0.gravatar.com/blavatar/e570ad0582780ba9dceddd311705fed4?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title></title>
		<link>http://codeboom.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://codeboom.wordpress.com/osd.xml" title="" />
	<atom:link rel='hub' href='http://codeboom.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Can you force someone to program?</title>
		<link>http://codeboom.wordpress.com/2012/02/21/can-you-force-someone-to-program/</link>
		<comments>http://codeboom.wordpress.com/2012/02/21/can-you-force-someone-to-program/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 14:44:10 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[a-level]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[coursework]]></category>
		<category><![CDATA[failure]]></category>
		<category><![CDATA[patients]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=164</guid>
		<description><![CDATA[I have to admit, I&#8217;ve been finding it hard to conjure up the enthusiasm to write about anything of late. When I thought about why this was, one of the reasons that has dampened my enthusiasm has been the yearly grind of the A-Level coursework. Although teaching is a very rewarding job at times, at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=164&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have to admit, I&#8217;ve been finding it hard to conjure up the enthusiasm to write about anything of late. When I thought about why this was, one of the reasons that has dampened my enthusiasm has been the yearly grind of the A-Level coursework. Although teaching is a very rewarding job at times, at other times it can be very hard to have how well YOU do your job judged on how well someone else performs in an exam or in a piece of assessed work. Someone posted this link on Twitter (I forgot who, sorry) which I found really interesting &#8211; <a href="http://www.huffingtonpost.com/shaun-johnson/treating-doctors-like-teachers_b_812096.html">what if we treated doctors the same way we treat teachers?</a> According to this article&#8217;s philosophy, if doctors were treated like teachers, when you chose to eat so much junk food you got heart disease and your doctor could not resolve it, your doctor would be the one judged to be failing! However on the other hand, I suppose you could argue that it is our job to work with our &#8220;patients&#8221; every day to ensure this does not happen &#8211; although we only have a limited amount of hours to make this happen.</p>
<p>Anyhow, nowhere is this judgement more prevalent than with the huge requirements of the A2 coursework &#8211; both in Computing and ICT A-levels &#8211; the requirement for this piece of work is ridiculously huge if compared to that of other subjects&#8217; A-level coursework. Not only do students have to produce pages and pages of documentation (around 100 pages for some of my A-grade projects), they also have to write a piece of software too. How is it fair to ask people to complete this amount of work when in other subjects they must simply write an essay &#8211; albeit a researched and re-drafted one? I also find the mark schemes to be an arcane science, it seems to be that the teacher has to guess what the moderator is looking for (let alone the students trying to guess!), and no amount of poring over the scant mark scheme descriptors, going on exam board courses or closely emulating the example projects can tell you what you are supposed to be presenting to gain the coveted marks.</p>
<p>And all that is even assuming you have a class of enthusiastic, motivated, A-grade students &#8211; what on earth does the prospect of this much work do for the lower end of students who take one look at it and immediately think they can&#8217;t do it and give up? I read an interesting article the other day which I now can&#8217;t find (curses!) about how programming exposes students to regular failure, which in our culture of ensuring success is not something they encounter often at school. Those who give up easily tend not to do as well in other academic areas, whereas those who show resilience and try to solve their own problems will generally do well elsewhere too. <a href="http://www.bbc.co.uk/news/education-16879336">This school might indeed have the right idea</a>. (Yet another cross-curricular boost from teaching Computing to tell your SLT about!)</p>
<p>So, I was thinking about how this kind of work could be better examined, and it&#8217;s a tough one.</p>
<p>I firstly thought about the <strong>coursework set at university</strong> in Computer Science &#8211; there was a lot of group work which had good and bad points. Good, because it enabled you to work with a mixture of people, to learn from them, and for the project to be more realistic &#8211; I think it&#8217;s fairly unlikely that in industry you would have to work on a project on your own. Bad because it meant some people didn&#8217;t do enough work and it was difficult to assess the individual&#8217;s contribution in a fair way.</p>
<p>Then I thought about <strong>doing away with coursework altogether</strong> &#8211; which would be rather silly for Computing to not have a practical element. It would probably result in more AQA style programming exams, which I am again not a fan of. I find that programming in an environment where you are unable to look anything up or use other resources to help you is very artificial &#8211; how many programmers remember the argument order of every single pre-written function in a library? Certainly not me.</p>
<p>Then I thought about <strong>just submitting source code</strong> without all of the analysis and other huge rainforest-killing documentation that has to go with it. Again, not a great idea because this makes for dreadfully badly thought out programs that don&#8217;t meet user requirements and are probably way too large in scope to be implemented. (Probably good for anyone who wants a career in programming for the public sector though! Ho ho ho.)</p>
<p>So in other words, like one of my other lecturers used to say, I don&#8217;t have the &#8220;silver bullet&#8221; of how to fairly examine Computing coursework. However, with the huge and really excellent grass roots movement that is sweeping up the new Computing curriculum, I hope this is something that teachers and industry professionals can offer some advice on, and that the exam boards may listen to and improve. For now, we&#8217;re stuck trying to encourage our students to produce programs and huge amounts of documentation through all of the usual stick and carrot methods available in school. Some good advice:</p>
<blockquote><p><a href="http://www.twitter.com/learningdomain">@learningdomain</a> &#8211; &#8220;start early&#8221;</p></blockquote>
<blockquote><p><a href="http://www.twitter.com/bringbackcs">@bringbackcs</a> &#8220;I say: Have you checked on-line guides? Have you worked through all tutorials? No?!! Let me know when you have.&#8221;</p></blockquote>
<p>&#8230; but it still feels like more of an achievement for the teacher having survived with everyone finished, than a test of the student&#8217;s software engineering capabilities.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/164/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/164/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/164/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=164&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/02/21/can-you-force-someone-to-program/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP shoutbox task</title>
		<link>http://codeboom.wordpress.com/2012/02/12/php-shoutbox-task/</link>
		<comments>http://codeboom.wordpress.com/2012/02/12/php-shoutbox-task/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 11:51:51 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Teaching]]></category>
		<category><![CDATA[access mode]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[concatenation]]></category>
		<category><![CDATA[interface]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[shoutbox]]></category>
		<category><![CDATA[write to file]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=152</guid>
		<description><![CDATA[Bizarrely enough, I recently started teaching topic #1 on the OCR AS ICT F452 module. The specification clearly isn&#8217;t design to be taught from beginning to end, and in fact I&#8217;ve found I jumped all over the place trying to teach it. We started off by looking at interface design principles using HTML and CSS, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=152&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="wp-image-153 alignright" title="shoutbox" src="http://codeboom.files.wordpress.com/2012/02/shoutbox.jpg?w=350&#038;h=182" alt="" width="350" height="182" />Bizarrely enough, I recently started teaching topic #1 on the OCR AS ICT F452 module. The specification clearly isn&#8217;t design to be taught from beginning to end, and in fact I&#8217;ve found I jumped all over the place trying to teach it. We started off by looking at interface design principles using HTML and CSS, given that we have so far only attempted command line Python interfaces, and I have yet to find an interface package for Python that would be suitable for a 17 year old to use &#8211; any ideas on this gratefully received? (I have tried Tkinter and wxpython with no joy.) I then thought back to a very old piece of programming my friend <a href="http://www.twitter.com/natbat">@natbat</a> did at university &#8211; a shoutbox &#8211; and here was the perfect opportunity to teach writing to files too!</p>
<p>In case you are not familiar with PHP, it is a server side language which processes your code and produces a static HTML page as a result. This means you need to run it through a web server, and for development I don&#8217;t think you can beat <a href="http://www.apachefriends.org">XAMPP</a> &#8211; a package with Apache web server, PHP and MySQL (should you want to teach databases) all bundled together in a convenient installer. (Small note: Apache uses port 80, and so does Skype, so if you do install it and it doesn&#8217;t work, check you aren&#8217;t running Skype before descending into a quivering wreck and asking the universe &#8220;why me&#8221;.) Please read the manual for better instructions, but the essentials of getting this working are 1) install, 2) start the server with xampp_control.exe, 3) put your files inside the htdocs folder 4) open a web browser and browse to the address http://localhost/yourdirectoryname/whateveryourfileiscalled.php</p>
<p>So we start off with a page containing a simple form, let&#8217;s call the page <strong>index.php</strong></p>
<pre>&lt;form action="page2.php" method="post"&gt;
 &lt;textarea name="shout"&gt; &lt;/textarea&gt;
 &lt;input type="submit" value="Shout out"/&gt;
&lt;/form&gt;</pre>
<p>The <strong>action</strong> attribute of the form specifies the page the data will be sent to when the button is clicked, and the <strong>method</strong> attribute specifies that the data will be sent via $_POST, i.e. secretly. There is a textarea for people to write things in, and a submit button. No need for PHP tags yet because although this page is saved with the extension .php we are writing only in HTML at the moment.</p>
<p>So on our unimaginatively named page2.php, at the most basic level we need to take the data from the form, which is conveniently provided to us in the array $_POST, and write it to a text file. Obviously you could also accomplish this task by storing the data in a database too, but the aim of this work was to teach writing to files.</p>
<p>So on <strong>page2.php</strong> we can add some PHP code as below</p>
<pre>&lt;?php
$fp = fopen("shouts.txt", "a");    // Open the file shouts.txt
fwrite($fp, $_POST['shout']."\n"); // Write the shout
fclose($fp);                       // Close the file
?&gt;</pre>
<p>This code is extremely basic. It opens the file shouts.txt in append mode (the second argument &#8220;a&#8221;). This means we are setting the file pointer to the end of whatever contents are in the file already, and writing there. There are other access modes &#8211; in fact this would be a good opportunity to teach them and to start getting students to look up functions on <a href="http://www.php.net">php.net</a> for themselves. Line 2 writes the shout plus a newline character (\n) to the file, and then line 3 closes the file. Incidentally, the index in the array $_POST['shout'] is the same as the name of the textarea in your form. Essentially, whatever you names you give your form elements will be the index of their data in the $_POST array.</p>
<p>Clever students will hopefully realise that there is a lot they could do to improve this code. Improvements they could make could include:</p>
<ul>
<li>A presence check to see whether text was actually entered into the form (at present this will write an empty line)</li>
<li>A length check if they do not want shouts to be over a certain length</li>
<li>An input sanitising check to remove things like HTML &#8211; functions like <a href="http://uk3.php.net/manual/en/function.htmlspecialchars.php">htmlspecialchars</a> could help &#8211; get them to look it up</li>
<li>They could add the date/time of the shout &#8211; <a href="http://uk.php.net/manual/en/function.date.php">date</a> function</li>
<li>You could add another input for the person&#8217;s name</li>
<li>They could pre-format the shout with HTML tags e.g. putting the person&#8217;s name bold</li>
<li>I&#8217;m sure there are other improvements I haven&#8217;t thought of&#8230;</li>
</ul>
<p>Now, we go back to <strong>index.php</strong> which is where we want to display a list of the shouts, below our form. There are several ways of doing this, here is one:</p>
<pre>&lt;?php
$shouts = file('shouts.txt');
$shouts = array_reverse($shouts);
$shouts = array_slice ($shouts, 0, 50);
foreach ($shouts as $item)
{
    print $item."&lt;br/&gt;";
}
?&gt;</pre>
<p>This code reads the file shouts.txt into an array. Each line of the file is a new element of the array, and since each shout is on a different line this should mean we have an array of shouts. I  then reverse the array to mean the most recent shouts are first, and then take a slice of the array so that only the top 50 most recent shouts are viewable. A foreach loop goes through this resulting array, printing the shouts (plus a line break) one by one. Again there are changes you could add to this code, for instance formatting the shouts in a prettier way. You could also have used the <a href="http://uk.php.net/manual/en/function.file-get-contents.php">file_get_contents()</a> function to read the entire file in as a string, and then <a href="http://uk.php.net/manual/en/function.explode.php">explode()</a> -ed the string on the newline character to get your array, although not sure why you&#8217;d want to from an efficiency point of view.</p>
<p>So, all in all a task which is excellent for teaching numerous things (writing to files, access modes, using a programming language manual, concatenation, array manipulation, interface design) and which is also very decent for differentiation &#8211; most people will be able to get a working shoutbox but more advanced students can make it very good indeed. Of course, you could upload finished products to a live webserver if you wished&#8230;but beware of inappropriate usage!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/152/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/152/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/152/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=152&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/02/12/php-shoutbox-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2012/02/shoutbox.jpg" medium="image">
			<media:title type="html">shoutbox</media:title>
		</media:content>
	</item>
		<item>
		<title>Computer Science &#8211; no one knows what it is</title>
		<link>http://codeboom.wordpress.com/2012/02/05/computer-science-no-one-knows-what-it-is/</link>
		<comments>http://codeboom.wordpress.com/2012/02/05/computer-science-no-one-knows-what-it-is/#comments</comments>
		<pubDate>Sun, 05 Feb 2012 13:44:49 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[a-level]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[perception]]></category>
		<category><![CDATA[phd]]></category>
		<category><![CDATA[physics]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=141</guid>
		<description><![CDATA[A short conversation with a Year 10 girl this week made me realise something sad &#8211; most students have no idea what Computer Science actually is. The girl referred to a colleague from my department who does not have a PhD as &#8220;Dr _X_&#8221;. (Well not literally Dr X, that makes him sound like a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=141&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A short conversation with a Year 10 girl this week made me realise something sad &#8211; most students have no idea what Computer Science actually is. The girl referred to a colleague from my department who does not have a PhD as &#8220;Dr _X_&#8221;. (Well not literally Dr X, that makes him sound like a Bond villain or something &#8211; just that I have omitted his real name.) When I informed her that Mr X would be very pleased to know he now had a PhD, she said something along the lines of &#8220;oh yes how silly, how could you have a PhD in Computers&#8221;.</p>
<p>I started to think about this comment a bit more carefully and I realised that the majority of students basically have no idea how their perception of &#8220;using a computer at school&#8221; translates to &#8220;a degree/PhD/useful qualification in Computer Science&#8221;. They have no idea of all the mathematics behind the subject, all of the logic, computation, design, systems analysis, everything good that comprises studying Computer Science at university &#8211; which makes me very sad. I remember turning up to my first university logic lecture (which regular readers will remember, was not trivial) thinking &#8220;eh, this isn&#8217;t what I signed up for&#8221;. That&#8217;s right, I admit it &#8211; I signed up for a Computer Science degree with absolutely no idea of what I was signing up for, other than the fact I liked computers and needed to do a degree. I remember wondering why I had to do Maths when that wasn&#8217;t what I&#8217;d signed up for and bitterly regretted not taking Maths A-Level. (Still do.) Happily though, I loved every minute of Computer Science!</p>
<p>Clearly what we are offering at the moment at school in KS3/4 is not getting this message across, and even though Michael Gove&#8217;s comment about ICT being &#8220;harmful&#8221; has been totally unhelpful and very skewed by the media, it may be the case if we are putting students off before they even find out about how exciting CS can be. One group of Year 9&#8242;s who questioned the value of what they were learning after watching some of the coverage during the BETT week were completely baffled when I pointed out that to create a video game you need Maths and Physics, as well as artists and designers &#8211; they just couldn&#8217;t see how the subjects were remotely related.</p>
<p>However, it&#8217;s not just students that need to know what Computer Science is really all about &#8211; it&#8217;s all the other people who have an influence on their life and their choices. Parents, careers advisors, form tutors &#8211; some of those people probably think studying Computer Science is the equivalent of (to borrow a quote from Bridget Jones&#8217; Diary) &#8220;swanning in in your short skirt and fannying around with the press releases&#8221;. I don&#8217;t blame them for this, it&#8217;s just that most people either a) have no experience of what a Computing lesson is like because they never had them at school or b) have a negative experience from being taught ICT at school. Every adult knows what happens in a maths lesson, we&#8217;ve all had them, but very few know what happens in a Computing lesson &#8211; so how can we be expecting them to recommend the subject?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/141/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/141/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/141/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=141&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/02/05/computer-science-no-one-knows-what-it-is/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>
	</item>
		<item>
		<title>Thinking task #3: Guess my number</title>
		<link>http://codeboom.wordpress.com/2012/01/15/thinking-task-3-guess-my-number/</link>
		<comments>http://codeboom.wordpress.com/2012/01/15/thinking-task-3-guess-my-number/#comments</comments>
		<pubDate>Sun, 15 Jan 2012 17:05:52 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[alevel]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[efficiency]]></category>
		<category><![CDATA[guess]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[recursion]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=137</guid>
		<description><![CDATA[Well, we&#8217;ve only been back at school for a very short time and it feels like I have never been away. The pile of marking is mounting, the websites I should really have implemented during the holidays are now politely tapping on my shoulder and demanding to be finished, the Mac Mini I was going [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=137&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Well, we&#8217;ve only been back at school for a very short time and it feels like I have never been away. The pile of marking is mounting, the websites I should really have implemented during the holidays are now politely tapping on my shoulder and demanding to be finished, the Mac Mini I was going to investigate is still sitting in its box on my study floor. So instead of taking care of all that, I&#8217;m going to write a blog post. (Well, I already ate the chocolate pudding so I didn&#8217;t have much left on my procrastination list&#8230;)</p>
<p>This week I have been covering recursion with the Lower 6th and also as revision with the Upper 6th. I quite like recursion because it makes me feel smart. Smart in the sense that I didn&#8217;t understand it at university and I do now&#8230;so maybe I would now understand all of those things our logic lecturer always said were &#8220;trivial&#8221;, were I to venture back to start my degree again. Maybe. Anyhow, the students wrote both iterative and recursive methods for finding the Fibonacci numbers and also computing factorials, and they were intrigued by the fact that the recursive function fell over when higher arguments were put in whereas the iterative version was able to cope with a lot larger arguments without throwing in the towel.</p>
<p>This led to a conversation about efficiency (happily on the syllabus!) and I thought of a sneaky way of getting them to implement a very basic number search algorithm &#8211; now we have a competition next week!</p>
<h3>The task</h3>
<p>1. You think of a number between 1 and 100.</p>
<p>2. The computer must use any means possible to guess the number. It may ask any question (except &#8220;what is your number?&#8221; or similar) in order to find out. Each &#8220;guess&#8221; of a number costs 1 point. Each &#8220;answer&#8221; that a user must give also costs 1 point. If an error occurs at any point, a 10 point penalty is awarded and that test is ended.</p>
<p>3. On the day of the competition, I will tell you the 5 items of test data. You will use this data to test your program, and the program which scores the least points across all 5 test items added together is the winner.</p>
<p>I like this idea, and so did they &#8211; I could tell because they were silent and their tongues were sticking out as they coded! I think it&#8217;s a good opportunity for:<br />
1) independent algorithm design<br />
2) discussion after the competition about why certain algorithms may be more efficient<br />
3) doing some testing of a real program<br />
4) thinking about interesting things such as whether some methods are more efficient at finding certain ranges of numbers, and other such discussions</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/137/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/137/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/137/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=137&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/01/15/thinking-task-3-guess-my-number/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>
	</item>
		<item>
		<title>Thinking Task #2: Mastermind &#8211; you need to be!</title>
		<link>http://codeboom.wordpress.com/2012/01/08/mastermind-you-need-to-be/</link>
		<comments>http://codeboom.wordpress.com/2012/01/08/mastermind-you-need-to-be/#comments</comments>
		<pubDate>Sun, 08 Jan 2012 14:01:46 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[comment]]></category>
		<category><![CDATA[mastermind]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[task]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=119</guid>
		<description><![CDATA[I thought I&#8217;d go with my own recommendation from my first post, and write a piece of code for my A2 students who are currently revising for their programming AS module in January to analyse. A Lower 6th student had suggested that a task could be to implement the &#8220;Mastermind&#8221; game which I had played [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=119&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I thought I&#8217;d go with my own recommendation from <a title="Teaching students to think" href="http://codeboom.wordpress.com/2011/12/20/teaching-students-to-think/">my first post</a>, and write a piece of code for my A2 students who are currently revising for their programming AS module in January to analyse. A Lower 6th student had suggested that a task could be to implement the <a href="http://en.wikipedia.org/wiki/Mastermind_%28board_game%29">&#8220;Mastermind&#8221; game</a> which I had played as a child. I think this is a fairly standard programming task, but it did actually cause me a little bit of aggro!</p>
<blockquote><p>Required knowledge: Functions, Selection, Iteration, Lists (arrays), String functions e.g. upper(), Random</p></blockquote>
<p>The basic premise of the game is that the problem setter picks a combination of four coloured pegs (usually from a choice of white, black, red, yellow, green, blue) and hides them. The guesser then has to guess the exact sequence. They give a series of guesses, to which the setter replies with how many are the right colour in the right place (denoted by a black peg), and how many are the right colour in the wrong place (a white peg). By a process of deduction the guesser can eventually figure out what the combination is.</p>
<p><a href="http://codeboom.files.wordpress.com/2012/01/mastermind.jpg"><img class="alignnone size-full wp-image-121" title="mastermind" src="http://codeboom.files.wordpress.com/2012/01/mastermind.jpg?w=600" alt=""   /></a></p>
<p>So far, so easy. By FAR the hardest part was figuring out how to return the correct result for the white peg. Black peg was a piece of cake, but I kept being caught out with multiple counting of correct colours in the wrong places, and tying myself in knots trying to debug things. I *think* this solution works, and even if it does I am sure there is probably a way more elegant solution that someone who is more mathematical than me could come up with.</p>
<h3>Some things students could do with this code</h3>
<p>(there are of course many more!)<strong><br />
</strong></p>
<p>1. Add comments to this code to explain what is happening at each stage of the program. There is no need to comment every line.<br />
2. Why is it necessary to use the line <strong>tempGuess = list(guess)</strong> instead of <strong>tempGuess = guess</strong>?<br />
3. Why do we need to make a copy of the lists anyway?<br />
4. Why do we keep a track of which letters we have checked using the list <strong>lettersChecked</strong>?<br />
5. What is the purpose of validation and why is it important?<br />
6. Which naming convention has been used in this code? Why are naming conventions important?<br />
7. Why do we bother to initialise our variables?<br />
8. At the moment, what happens when the player exceeds the number of guesses allowed? Can you add some code to let the user know when they have lost?<br />
9. Draw up a test plan for 5 black box tests on this code, each test being from a different group of test data.<br />
10. Supposing you wished to add the colour Blue as a valid colour, could you alter the code to include this whilst keeping input simple for the user?<br />
11. The line <strong>while True:</strong> near the beginning of the <strong>validateInput()</strong> function is an infinite loop. Why doesn&#8217;t this result in the program running forever?</p>
<p>I&#8217;m not going to ask them to do this, but this code would be an excellent introduction to programs with a GUI &#8211; you could write the algorithm with a text based output and then once they have learnt how to display things on a GUI, ask them to revisit it and make it graphical.</p>
<p>Another obvious extension that I think is rather more university level, although there appear to be various algorithms documented, would be to add an option for the user to be the setter and the computer to be the solver. However, a useful discussion about efficiency could come about if you asked students to consider what the computer&#8217;s guessing strategy should be, and then compared their answers to the algorithms.</p>
<p>Of course, if you are not using Python as your language of choice, you could easily translate this code to most other languages.</p>
<p>If you have any other suggestions of possible questions or improvements I could set for my upper 6th, do share them.</p>
<p>Here is the (deliberately uncommented) Python code:</p>
<pre>import random

def validateInput():
    inputGuess = raw_input("Enter your guess as 4 letters e.g. XXXX:")

    while True:
        if len(inputGuess) != 4:
           inputGuess = raw_input("Enter your guess as 4 letters e.g. XXXX:")
        else:
            wordList = list( inputGuess.upper() )

            invalidLetters = False
            for letter in wordList:
                if letter not in ['R','G','Y','B','W']:
                    invalidLetters = True 

            if invalidLetters == True:
                print "Possible colours are R G Y B W"
                inputGuess = raw_input("Enter your guess as 4 letters e.g. XXXX:") 

            else:
                return wordList

guessesRemaining = 12
code = []
guess = []
correctPosition = 0
correctColour = 0

for i in range(4):
    code.append(random.choice(['R','G','Y','B','W']))

print "Guess my sequence of four colours, in the correct order."
print "\nPossible colours are R G Y B W"

while guessesRemaining &gt; 0:

    correctPosition = 0
    correctColour = 0
    lettersChecked = []

    guess = validateInput()
    guessesRemaining -= 1 # Deduct one guess

    tempGuess = list(guess)
    tempCode = list(code)

    for i in range(4):
        if guess[i] == code[i]:
            correctPosition += 1
            tempGuess[i] = "X"
            tempCode[i] = "X"

    for j in range(4):

        if tempGuess[j] in tempCode and tempGuess[j] != "X" and tempGuess[j] not in lettersChecked:

            if tempCode.count(guess[j]) &gt; tempGuess.count(tempGuess[j]):
                correctColour += tempGuess.count(tempGuess[j])

            else:
                correctColour += tempCode.count(tempGuess[j])

            lettersChecked.append(tempGuess[j])

    if correctPosition &gt; 0:
        print "You had",correctPosition,"correct colours in the correct place"
    if correctColour &gt; 0:
        print "You had",correctColour,"correct colours in the wrong place"

    if correctPosition == 0 and correctColour == 0:
        print "No correct colours"

    if correctPosition == 4:
        print "You won in",12-guessesRemaining,"guesses, congratulations!"
        guessesRemaining = 0

print "Thanks for playing"</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=119&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/01/08/mastermind-you-need-to-be/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2012/01/mastermind.jpg" medium="image">
			<media:title type="html">mastermind</media:title>
		</media:content>
	</item>
		<item>
		<title>Coding, &#8220;the crappy way&#8221;</title>
		<link>http://codeboom.wordpress.com/2012/01/04/coding-the-crappy-way/</link>
		<comments>http://codeboom.wordpress.com/2012/01/04/coding-the-crappy-way/#comments</comments>
		<pubDate>Wed, 04 Jan 2012 14:36:58 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[adventure]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[crappy]]></category>
		<category><![CDATA[dict]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[habits]]></category>
		<category><![CDATA[mud]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=101</guid>
		<description><![CDATA[I was talking to my friend Tristan the other day, via the MUD which he has created and programmed himself. If you don&#8217;t know what a MUD (Multi User Dungeon) is, it&#8217;s a sort of a text based adventure world where you can interact with other people, and move between various rooms and locations, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=101&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was talking to my friend Tristan the other day, via the MUD which he has created and programmed himself. If you don&#8217;t know what a MUD (Multi User Dungeon) is, it&#8217;s a sort of a text based adventure world where you can interact with other people, and move between various rooms and locations, and interact with various objects. If you are about my age you probably remember those books in which you read a paragraph and then at the bottom it gives you a choice of &#8220;go to page 46&#8243; or &#8220;go to page 32&#8243; &#8211; at which point you secretly keep your finger in the original page just in case your choice of page 46 leads to you being eaten horribly by some kind of dragon. It&#8217;s a bit like World of Warcraft with no graphics, or an IRC client with dragons &#8211; take your pick.</p>
<p>I digress.</p>
<p>Near the start of this year, I had suggested that students have a go at creating their own text based adventure game as an early task in Python. I gave them this code as a template, and asked them to continue:</p>
<pre># Python adventure game

# Define the direction variable
direction1 = ''

# Print out a statement setting the scene for the user
print """As you step into the cave you can smell musty cobwebs and the
dank odour of dripping water. At the back of the cave the path forks
and you can see two directions to travel, left and right."""

# Keep doing this until they have entered either left or right
while direction1 not in ["left","right"]:

    # Ask the user where they want to go
    direction1 = raw_input("Do you want to go left or right?: ")

    # Decide what happens
    if direction1 == "left":
        print "\nYou have entered the bear's lair!"
        print "Sadly all that is left of you is a pile of bones."
    elif direction1 == "right":
        print "\nThe back of this passage seems to lead somewhere..."
    else:
        print "That is not a direction"</pre>
<p>I&#8217;m not afraid to admit, this was not one of my finer tasks because it doesn&#8217;t take a genius to figure out (but perhaps this did not occur to a sleep deprived teacher) that very quickly you are going to get in a huge muddle of where you are, which direction you can go in and which you can&#8217;t &#8211; let alone add in usable items and an inventory! Still, it was a nice practice of lots and lots of nested if statements&#8230;</p>
<p>I thought I&#8217;d ask Tristan how he would go about solving this problem &#8211; and his first response was that he&#8217;d use classes. Spanner in the works then, because I told him that we don&#8217;t seem to cover any Object Oriented programming at all at AS Level. His second idea was to use the dictionary construct in Python, which is different to the list construct which I usually use to teach arrays, because it allows you to use string keys. (Of course, if PHP were a supported language of the exam board, we wouldn&#8217;t have to bother with either we&#8217;d just use arrays *grumble* <img src='http://s0.wp.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ) This seemed like a pretty good idea, and we discussed how we would go about it, with the discussion coming to a close on his comment of</p>
<blockquote><p><em><strong>&#8220;well you do know this is the crappy way of doing it?&#8221;</strong></em></p></blockquote>
<p>This got me thinking&#8230;a lot of the time when we are teaching programming, we are actually teaching &#8220;the crappy way&#8221; of doing something &#8211; and not the way that a real life programmer would approach it. Sometimes this is because the crappy way of doing it is actually more understandable to the learner&#8230;a prime example of this which comes to mind is in PHP when you extract all items from an array (most commonly a query result) into variables with the key names. e.g.</p>
<pre>$fruit = array("orange" =&gt; 1, "apple" =&gt; 2, "pear" =&gt; 1);
extract($fruit);
print $orange;
// Output will be 1</pre>
<p>I suspect that most experienced programmers would not use this much (and especially not on form data!) but often it&#8217;s easier to just suggest doing it to avoid the hassle of explaining how to use array keys and then getting a blank look. Even though you&#8217;ve covered arrays for approximately 4 weeks and done 10 past papers on it. I exaggerate.</p>
<p>So is this a bad thing? I remember being rather miffed in Science lessons when I was in school that we would be taught something in Year 7, and then the next year they would say &#8220;well that&#8217;s not completely true, it&#8217;s actually like this&#8221;&#8230;and so on. As much as I cringe a little bit inside every time I have to do it, I don&#8217;t think that teaching <em><strong>some</strong></em> things &#8220;the crappy way&#8221; is necessarily bad. I&#8217;m not saying that we should forget good habits like variable names, indentation, and algorithm efficiency &#8211; far from it &#8211; but as long as they are aware that there are other ways of achieving the same result, you are still teaching a method which works. It&#8217;s not the most efficient way, but it gives the students a starting point to work from rather than totally confusing them and making them feel like they&#8217;ll never be any good and might as well pack up now. That&#8217;s why we are teachers, that&#8217;s why we are here &#8211; to teach the foundations of the subject and to ignite an interest in programming, not to make a legion of perfect programmers. If they are interested enough to go and look up how things could be done more efficiently and properly, and tell you off for your terrible code &#8211; GREAT! Our work here is done. If not, at least their program worked. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  At present I have one of my Lower 6th classes picking me up on EVERY piece of bad coding, poor variable naming, or general mistakes they possibly can, and I LOVE IT!!!</p>
<p>Oh and in case you&#8217;re wondering, here&#8217;s the foundations of the text adventure game, using the dictionary constructs in Python</p>
<pre># Python adventure game using dictionaries

# Validate their input direction

def input_direction():
    direction = raw_input("Which direction do you want to go? ")
    while direction not in ["north", "south", "east", "west", "exit"]:
        direction = raw_input("Which direction do you want to go ")

    return direction

# ---------------------------------------------
# Set up the rooms

compass = dict({ "north" : {0: 1, 1:2, 2:-1},
                 "south": {0: -1, 1:0, 2:1}
                })

descr = dict({0: "You are in a small lobby type room.",
              1: "You are in a grand hall way",
              2: "You are in a huge palace"})

currentRoom = 0
newDir = ""

# Game loop
while( currentRoom != -1 ):

    # Describe the current room
    print descr[currentRoom]

    # Ask what they want to do
    newDir = input_direction()

    # If they wish to exit
    if newDir == "exit":
        print "See ya later, alligator!"
        currentRoom = -1
    else:

        # Otherwise look up whether there is a path that way
        if compass[newDir][currentRoom] != -1:
            currentRoom = compass[newDir][currentRoom]
        else:
            print "There is no path in that direction"</pre>
<p>In case you are interested, a link to <a href="http://www.antikaria.com/">Tristan&#8217;s MUD</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/101/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/101/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/101/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=101&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/01/04/coding-the-crappy-way/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>
	</item>
		<item>
		<title>Appy new year!</title>
		<link>http://codeboom.wordpress.com/2012/01/02/appy-new-year/</link>
		<comments>http://codeboom.wordpress.com/2012/01/02/appy-new-year/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 11:33:10 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[apps]]></category>
		<category><![CDATA[dropbox]]></category>
		<category><![CDATA[evernote]]></category>
		<category><![CDATA[ipad]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[splashtop]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[whiteboard]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=85</guid>
		<description><![CDATA[I am very lucky that my school is doing an iPad trial to see whether this pretty desirable piece of kit is actually any good inside the classroom, instead of the (not usually very) trusty teachers laptop. After bowing and scraping and making lots of coffee in the techies office, I managed to get my [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=85&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I am very lucky that my school is doing an iPad trial to see whether this pretty desirable piece of kit is actually any good inside the classroom, instead of the (not usually very) trusty teachers laptop. After bowing and scraping and making lots of coffee in the techies office, I managed to get my hands on one to try out last term.</p>
<p><a href="http://codeboom.files.wordpress.com/2012/01/lauras_ipad1.jpg"><img class="alignnone size-full wp-image-86" style="margin:10px;" title="lauras_ipad1" src="http://codeboom.files.wordpress.com/2012/01/lauras_ipad1.jpg?w=600" alt=""   align="left" /></a> My preciousss&#8230;</p>
<p>*ahem* The first thing I noticed is that the iPad is somewhat shiny, and the second thing I noticed was that it would not continue to be quite as shiny if it were to be subjected on a daily basis to the unceremonious dumping in handbag/book bag on the mad stampede to ensure that the chocolate biscuits are not all taken when you get to break. If they really made these things for teachers they would probably need to look a bit more like a Fisher Price plastic coated contraption than the executive cool that is the iPad (2, 16GB with 3G in case you&#8217;re wondering. Not that I have a SIM card). So I ventured on to the internet and spent lots of my own hard earned cash on some covers to ensure that the precious would stay as shiny as possible.</p>
<p><strong>Apps</strong></p>
<p><strong></strong>I have had an iPhone for ages but to be perfectly honest, apart from a few fairly futile Hiragana learning apps (which seem to shout out the answer at the same time as testing you&#8230;.ehh?) most of the apps I have are not particularly educational. I decided to pick the brains of a few other people who recommended some apps for me to try out.</p>
<p><span style="text-decoration:underline;"><em>Splashtop Whiteboard</em></span><em> &#8211; £6.99</em></p>
<p><img class="alignnone" style="margin:10px;" title="Splashtop Whiteboard" src="http://img-ipad.lisisoft.com/imgmic/2/1/2100-1-splashtop-whiteboard.jpg" alt="" width="105" height="105" align="left" />(This is not the same as Splashtop Remote Desktop, so don&#8217;t get all excited that the price has gone down to £2.99 and buy the wrong app by mistake.)<br />
This is probably the best app I have in terms of teaching, and it certainly impresses the students. First you must download a small program onto your desktop PC &#8211; which I know sounds like a very simple feat but I have also worked in schools where installing any piece of software on a computer results in a lot of umming, ahhing and sucking in of air through the teeth from the techies as if you&#8217;d asked them to pole vault over Everest. Luckily our techies are rather nice and allow me to fiddle with most things on our desktops &#8211; thank you techies! The app then allows you to connect to your Windows PC via remote desktop &#8211; OMG, Windows on an ipad &#8211; gets people every time. Well, so what. You have a glorified Powerpoint presentation screen, and not a lot else, right? Admittedly it is extremely useful when presenting, and I am looking forward to using it with the L3 Extended Project presentations this summer, as in another disguise I am a supervisor for Perspectives on Science.</p>
<p>However the best bit of this app and the reason you pay the extra 4 quid for it, is that it has the kind of tools you get with Promethean and SMART boards, built in! You can annotate on the screen, you can add icons, type in text&#8230;and even better, you can hand the ipad around in the classroom and have THEM do it! Admittedly there is a little bit of lag which can have hilarious results if the kid is looking on the whiteboard and not on the ipad, but it made for a much more entertaining &#8220;spot the mistakes&#8221; type intro with Year 9. I did try to use it for a revision class with Year 13 where I asked them to write some code but due to the fact that most of the frequently occurring code symbols (brackets, colons and the like) are on the 3rd page of the on screen keyboard, this did not go so well.</p>
<p><em><span style="text-decoration:underline;">Evernote</span></em> &#8211; Free</p>
<p><img class="alignnone" style="margin:10px;" title="Evernote" src="http://a2.twimg.com/profile_images/130163301/en_app_icon_256.png" alt="" width="92" height="92" align="right" />Someone recommended I get this because it allows you to take notes and keep pictures in the same place. I thought I would try it out by keeping notes on the progress of my A2 coursework and EP supervisees. To be honest I didn&#8217;t last long with using this and it wasn&#8217;t through the fault of the app itself which is actually very well made. One of my other colleagues on the trial pointed out that the iPad is extremely good for consuming but not very good for creating, and I agree with this statement. I can touch type and I suspect many ICT/Computing teachers can too. If you can touch type you will find the on screen keyboard SO UNBELIEVABLY FRUSTRATING, especially if you have long nails. If you are someone who cannot touch type but has learnt to type fast with two fingers however, you will probably love it. I haven&#8217;t used Evernote very much because of this reason, I find it takes me 3 times as long to write things up on the ipad than it would to log on to the PC and do it. However, it is neat to have things in one place, and the app is thoughtfully made, so you may love it.</p>
<p><em><span style="text-decoration:underline;">Dropbox</span></em> &#8211; Free</p>
<p><img class="alignnone" style="margin:10px;" title="Dropbox" src="https://s3.amazonaws.com/damang02272010/blog_photos/dropbox_logo.png" alt="" width="92" height="92" align="left" />This app is so awesome, and the PC version is almost even better (although it does eat a bit of a chunk of my Vista CPU usage, grrah). It is essentially FREE storage on the internet, and you can drag and drop files from your PC and view them on your ipad. Don&#8217;t bother printing out the minutes of a meeting, bring your ipad and have it there in front of you (and other much more rock &#8216;n roll uses, no doubt!) Sadly, I suspect many schools will have blocked Dropbox so you may find you are unable to use the website. Another potential issue is that you shouldn&#8217;t use it to store confidential files or information about students &#8211; but this is just common sense to me. I use it to save those worksheets I created at home and need to use the next day in school, and it does me proud. And if you&#8217;re too stingy to pay for the extra storage, just keep putting stuff up and deleting stuff as and when necessary. It&#8217;s like having your own free USB stick that also works on your iPad. Awesome.</p>
<p>Do you know of any apps which would be good for teaching? Have you done something cool with an iPad in your lesson? Let me know on here or via Twitter <a title="CodeBoom" href="http://www.twitter.com/codeboom">@codeboom</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/85/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/85/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/85/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=85&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2012/01/02/appy-new-year/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2012/01/lauras_ipad1.jpg" medium="image">
			<media:title type="html">lauras_ipad1</media:title>
		</media:content>

		<media:content url="http://img-ipad.lisisoft.com/imgmic/2/1/2100-1-splashtop-whiteboard.jpg" medium="image">
			<media:title type="html">Splashtop Whiteboard</media:title>
		</media:content>

		<media:content url="http://a2.twimg.com/profile_images/130163301/en_app_icon_256.png" medium="image">
			<media:title type="html">Evernote</media:title>
		</media:content>

		<media:content url="https://s3.amazonaws.com/damang02272010/blog_photos/dropbox_logo.png" medium="image">
			<media:title type="html">Dropbox</media:title>
		</media:content>
	</item>
		<item>
		<title>Sell Computing A-Level in 3 minutes</title>
		<link>http://codeboom.wordpress.com/2011/12/27/sell-computing-a-level-in-3-minutes/</link>
		<comments>http://codeboom.wordpress.com/2011/12/27/sell-computing-a-level-in-3-minutes/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 14:42:03 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Teaching]]></category>
		<category><![CDATA[computing. a-level]]></category>
		<category><![CDATA[pitch]]></category>
		<category><![CDATA[choices]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[economics]]></category>
		<category><![CDATA[hot italians]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=72</guid>
		<description><![CDATA[One year, I rocked up at school on the 1st September and a huge (but not too huge) set of amazing A-Level pupils walked in the door eager to learn about recursion, black box testing and the intricacies of 8 bit binary. Then I woke up and realised that was all a dream and I [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=72&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One year, I rocked up at school on the 1st September and a huge (but not too huge) set of amazing A-Level pupils walked in the door eager to learn about recursion, black box testing and the intricacies of 8 bit binary. Then I woke up and realised that was all a dream and I had to devise a way of selling Computing A-Level to the whole of Year 11, in three minutes, during an assembly in January. Wowzers.</p>
<p><a href="http://codeboom.files.wordpress.com/2011/12/latesttechnology2.jpg"><img class="alignnone size-full wp-image-74" title="latesttechnology2" src="http://codeboom.files.wordpress.com/2011/12/latesttechnology2.jpg?w=600" alt=""   /></a></p>
<p><em>&#8220;You should definitely do Computing &#8211; the department has all the latest technology&#8221;</em></p>
<p>I think when I first became a teacher I grossly underestimated how much selling and persuading is necessary to encourage students to do your subject. When first confronted with this task three years ago, my shoulder demon protested &#8220;but I&#8217;m a techy person, I didn&#8217;t sign up to be a saleswoman!&#8221;, although this is perhaps a rather feeble excuse given that a) I chose to be a teacher and therefore pretty much &#8220;on show&#8221;, and b) other techy people (Steve Jobs?) seem to make a damn good job of selling things. So eventually I stopped whining to myself and got on with the task of creating the obligatory Powerpoint presentation to go with my &#8220;Computing is not the same as IT&#8221; talk.</p>
<p>The first year we decided to go with the serious version and just explain what the subject was and why it was different to what had gone before. We were rather spectacularly upstaged by the presentation for Italian AS which contained equal measures of humour and pictures of hot Italians. Damn.</p>
<p>Last year, we decided to go down the entertaining route too, which actually proved rather profitable. Students who did not even choose the subject still remember and ask me about the first slide &#8211; the oh-so-hilarious &#8220;There are 10 types of people in the world, those who understand binary and those who don&#8217;t&#8221; joke &#8211; mostly because they DIDN&#8217;T GET THE JOKE AND WERE CURIOUS!! Yes! This is exactly the kind of interest I wanted to generate, a curiosity to find out more. I will always remember a particular lecture from university which was a module on the programming language Lisp where the lecturer implemented something to do with traffic lights. (I bet you are probably thinking &#8220;you can&#8217;t remember it <em>that</em> well&#8221; &#8211; /rasp to you.) Well, what I do remember is that after it had been explained it all seemed so simple and obvious, and yet so clean and, dare I say it without sound like a maths geek, beautiful. I wanted to know more. It&#8217;s a bit of a tall order to impart such a revelation in three minutes, but I&#8217;m going to try.</p>
<p>One thing which scares me a little bit is that no matter how good my 3 minute pitch is (and happily we also have some &#8220;taster lessons&#8221; this year too), I will not be pitching to parents. I know that the perception of Computing is hopelessly muddled in with that of ICT as a &#8220;doss subject&#8221; and a &#8220;subject Universities don&#8217;t like&#8221;, and our challenge can be ably summed up by the <a href="http://www.computingatschool.org.uk/index.php?id=the-challenge">Computing at School website</a>. A friend who is an Economics teacher told me that in the first week of the new term, he asked everyone in his Economics class to tell him why they had chosen that subject. He was very surprised at the answer from a lot of pupils, particularly girls, which was &#8220;because my Dad thought it was a good idea&#8221;. I really hope that Dads out there like Computing as much as they like Economics.</p>
<p>Anyhow, I thought I would ask &#8211; since there are probably a lot of us in the same boat &#8211; <em><strong>how would you sell A-Level Computing in 3 minutes?</strong></em> Leave a comment or tweet me <a href="http://www.twitter.com/codeboom">@codeboom</a> so I can shamelessly pilfer your ideas <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=72&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2011/12/27/sell-computing-a-level-in-3-minutes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2011/12/latesttechnology2.jpg" medium="image">
			<media:title type="html">latesttechnology2</media:title>
		</media:content>
	</item>
		<item>
		<title>Thinking Tasks #1 &#8211; Boxes function</title>
		<link>http://codeboom.wordpress.com/2011/12/22/thinking-tasks-1-boxes-function/</link>
		<comments>http://codeboom.wordpress.com/2011/12/22/thinking-tasks-1-boxes-function/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 16:04:56 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[a-level]]></category>
		<category><![CDATA[boxes]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[loop]]></category>
		<category><![CDATA[procedure]]></category>
		<category><![CDATA[selection]]></category>
		<category><![CDATA[task]]></category>
		<category><![CDATA[thinking]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=44</guid>
		<description><![CDATA[Quite often after covering a big chunk of theory, I will try to get students to think about how to actually put it into practice. This task was very successful and resulted in one student going away and spending hours trying to figure out how to make the boxes work perfectly. After a bit more [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=44&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Quite often after covering a big chunk of theory, I will try to get students to think about how to actually put it into practice. This task was very successful and resulted in one student going away and spending hours trying to figure out how to make the boxes work perfectly. After a bit more theory, it is nicely reusable too in the Noughts and Crosses game (with a little bit of a tweak to print the contents of a 2D array inside the boxes.)</p>
<p><strong>Knowledge needed:</strong> Loops, Conditional statements, Print statements</p>
<p>&nbsp;  </p>
<h3>1. Create some code which will print a box that looks like this:</h3>
<pre>+ -- +
|    |
+ -- +</pre>
<p>This is a useful learning exercise in itself as students will realise they must print on three separate line to make the box. It also introduced the pipe character which might be useful when they encounter it as the &#8220;or&#8221; operator in some other languages.</p>
<p>&nbsp;  </p>
<h3>2. Now make some code that will use a loop to print a row of boxes.</h3>
<p>Here is a good opportunity to use a for loop, e.g. for i in range(5) should print 5 boxes</p>
<pre>+ -- + -- + -- + -- + -- +
|    |    |    |    |    |
+ -- + -- + -- + -- + -- +</pre>
<p>Fairly predictably, the first thing you will get will be some code that looks a little bit like this and results in a huge mess.</p>
<pre>for i in range(5):
    print "+ -- +"

for i in range(5):
    print "|    |"

for i in range(5):
    print "+ -- +"</pre>
<p><strong></strong><span style="text-decoration:underline;">Why does this code not work?</span> The print statement moves on to the next line before we are ready. I would then offer this hint: If you don’t want to move on to the next line after printing something, put a comma e.g. <em>print “+”, </em> This will probably result in them simply inserting a comma at the end of the print statement, which means everything is on the same line (albeit wrapped by the display.)<br />
<span style="text-decoration:underline;">When do we want to move on to the next line then?</span> Hopefully, some clever person will realise that we need to move to the next line after each loop is done, which is a fabulous place to ask &#8220;well how can we do something outside of the loop&#8221; and hammer home the beautiful elegance of proper indentation. I suppose you could move on to the next line by printing an empty string with a comma, but this is also a great opportunity to point out that if you did it like that, you would end up with this:</p>
<pre>+ -- ++ -- +
|    ||    |
+ -- ++ -- +</pre>
<p>..which is not desirable. As my University logic lecturer used to say, the solution to this is trivial. I used to loathe this expression because I usually had no idea what he had been talking about for the previous 40 minutes, so the solution is below. Please don&#8217;t hate me! <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>for i in range(5):
    print "+ --",

print "+"

for i in range(5):
    print "|   ",

print "|"

for i in range(5):
    print "+ --",

print "+"</pre>
<p>&nbsp;  </p>
<h3>3. Now see if you can use a nested loop to create a square of boxes.</h3>
<p>This is useful to reinforce the concept of &#8220;nesting&#8221;. I usually find students think nesting is the same as indentation. We could just whack a for loop around all three of these other loops and call it a day. However this would have the same problem of duplicate tops and bottoms of boxes that we just solved in part 2 for the sides. The solution is of course to only print the top row once (use an if statement to determine whether this is the first iteration of the outer loop), and then print all of the other rows as U shapes:</p>
<pre>|    |
+ -- +</pre>
<p>Again, try to have them come up with this &#8211; if there are enough people in your class (there never seem to be in mine) they could be working on this problem in pairs or groups. Quite often I find myself going too quickly over things which are really obvious to me &#8211; I have to stop myself and not panic about taking 10 minutes over something I think is easy, if it&#8217;s a really valuable thinking experience for the class.</p>
<p>&nbsp;  </p>
<h3>4. Put your code into a procedure <em>boxes(rows,cols)</em></h3>
<p>Not too tricky you might think, but often tough to reconcile their understanding that the number of times the loop executes is the number of rows or columns in the box.</p>
<pre>def boxes(rows, cols):
   # Define rows loop
   for i in range(rows):

      # Put previous column loops here</pre>
<p>&nbsp;  </p>
<h3>5. Extensions &#8211; other stuff you can reasonably ask them to do</h3>
<p>It&#8217;s always useful to have something else up your sleeve to challenge the really adventurous ones. These are things I have asked people to do, with decent results:</p>
<ul>
<li>Validate the arguments to the procedure to check they are actually integers</li>
<li>You may also wish to validate that the arguments are within a given range as if you call the procedure with very large arguments a runtime error will occur due to lack of memory</li>
<li>Print column numbers (i.e. each row has 1, 2, 3, 4&#8230;etc. in the boxes)</li>
<li>Print ascending numbers in the boxes (e.g. for a 3 by 3 box, you would get 1 2 3 in the top row, 4 5 6 in the second row and 7 8 9 in the bottom row)</li>
</ul>
<p>(Note: both of these are not too hard, but for two or three digit numbers will utterly mess up the pretty linear fashion of the boxes! They will also annoy the students because of the loop counter starting at 0 thing&#8230;something good to get used to!)</p>
<ul>
<li>Print the ascending numbers in the boxes as above, without the boxes breaking and looking like a dog&#8217;s brekkie. Bow wow.</li>
</ul>
<pre>+ -- + -- + -- +
|  1 |  2 |  3 |
+ -- + -- + -- +
|  4 |  5 |  6 |
+ -- + -- + -- +
|  7 |  8 |  9 |
+ -- + -- + -- +</pre>
<p>&nbsp;  </p>
<h3>Worksheet and the solutions</h3>
<p>Here is the <a href="http://codeboom.files.wordpress.com/2011/12/pdf_icon_small.jpg"><img class="alignnone size-full wp-image-31" title="pdf_icon_small" src="http://codeboom.files.wordpress.com/2011/12/pdf_icon_small.jpg?w=600" alt=""   /></a> <a title="worksheet I give out to go with this lesson" href="http://codeboom.files.wordpress.com/2011/12/thinking_tasks_boxes.pdf">Thinking_Tasks_Boxes</a> worksheet I give out with this lesson. It&#8217;s not the prettiest worksheet ever, but it works. I have full solutions to all of the problems including the extensions, but to avoid enterprising students (including my own!) using them you&#8217;ll need to tweet me <a title="CodeBoom" href="http://www.twitter.com/codeboom">@codeboom</a> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Also two other things. Is it possible to get a syntax highlighter for WordPress? And also check out the &#8220;Sweet resources&#8221; section (Dude!) for my full student book for OCR AS Computing F452.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=44&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2011/12/22/thinking-tasks-1-boxes-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2011/12/pdf_icon_small.jpg" medium="image">
			<media:title type="html">pdf_icon_small</media:title>
		</media:content>
	</item>
		<item>
		<title>Teaching students to think</title>
		<link>http://codeboom.wordpress.com/2011/12/20/teaching-students-to-think/</link>
		<comments>http://codeboom.wordpress.com/2011/12/20/teaching-students-to-think/#comments</comments>
		<pubDate>Tue, 20 Dec 2011 13:40:47 +0000</pubDate>
		<dc:creator>codeboom</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[a-level]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[computing]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[pseudo]]></category>
		<category><![CDATA[think]]></category>
		<category><![CDATA[thinking]]></category>

		<guid isPermaLink="false">http://codeboom.wordpress.com/?p=22</guid>
		<description><![CDATA[The hardest thing I find as a Computing teacher is teaching students to think. They always seem to get totally hung up on the syntax of how you are supposed to write a particular statement (my students&#8217; favourite being the &#8220;if loop&#8221; &#8230;Grrrrr&#8230;) or where the colons are meant to go. I&#8217;m teaching using Python [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=22&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The hardest thing I find as a Computing teacher is teaching students to think. They always seem to get totally hung up on the syntax of how you are supposed to write a particular statement (my students&#8217; favourite being the &#8220;if loop&#8221; &#8230;Grrrrr&#8230;) or where the colons are meant to go. I&#8217;m teaching using Python which I chose deliberately for three reasons. One &#8211; it has the most minimal of syntax twiddles, for example no curly brackets and semicolons. Two &#8211; It forces you to use proper indentation (halleluiah!) and data types. Three &#8211; it was recommended by OCR in their support materials for teachers. They promptly un-recommended it when I asked them a tricky question. Ho hum.</p>
<p><strong>How do you get students to think?</strong></p>
<p>OK so you&#8217;ve taught them the theory behind something, and now you&#8217;re asking them to go off and write a program to perform a particular task. I usually find one of the following things happens:</p>
<p>- Very good students will act like programmers. They write the program in small parts, test as they go along, and experiment with things. These are the ones who will go away and in their own time play around to make the program even better. They might even (shock horror) look things up in the textbook or online.<br />
- The majority of students will write a behemoth of a program, then run it, receive a syntax error, don&#8217;t bother to read the error and then give up and ask for help.</p>
<p>Argh.</p>
<p>So how do you turn someone into a programmer? I really don&#8217;t know, but these are some of the things I think could be useful:</p>
<p><strong>Students must practice</strong> &#8211; I always compare my job to that of a football coach. The football coach can give tips all day long, and that might improve the player a little bit. But if the player doesn&#8217;t practice, he won&#8217;t get any better. As soon as they investigate and try things of their own accord, they will become better &#8211; I have this on authority from a Computer Science lecturer.</p>
<p><strong>Use games</strong> &#8211; I like teaching using games, because it interests the students and they are more likely to try to think if they are interested in the task. Games I have used include Blackjack, Magic 8-Ball, Noughts and Crosses, Higher-Lower, Text adventure games etc. I&#8217;ll post some of these (Python) worksheets and solutions at a later date.</p>
<p><strong>Use functions early on</strong> &#8211; In my experience, most students don&#8217;t like using functions as they would prefer to simply write a huge program. If you don&#8217;t use them early on, I think it would be very difficult to persuade them to use them at all after bad habits have been established. Also, for the love of god, make them separate out their functions and main section (a comment with #&#8212;&#8212;&#8212;- will do) or you will be going cross eyed trying to find variable definitions and random input lines in the middle of function definitions. This Is Not Fun.</p>
<p><strong>Stop helping</strong> &#8211; OK I&#8217;m not saying don&#8217;t help at all. I find students are very adept at getting you to do their work for them. I don&#8217;t mean sitting down and programming it, I mean asking for help on small parts of a program, so often that when you come to mark it you find out you wrote most of it yourself. It&#8217;s hard to do but if you can train them to ask for help in the manner of &#8220;I&#8217;m trying to do X but it isn&#8217;t working&#8221; or &#8220;What I want to do here is X but I don&#8217;t know how to do Y&#8221; instead of just &#8216;help i&#8217;m stuck&#8217; then it makes them think before reaching for the crutch.</p>
<p><strong>Give pre-written programs for them to decode and discuss</strong> &#8211; I suck at this. I usually try to get students to write a program from some instructions or something they have learnt in class. I think that on occasion there is a huge benefit from not teaching them anything, giving a pre-written program you made yourself and getting them to investigate how and why it works (in a way structured by you of course). After all, isn&#8217;t this how most &#8220;Be an amazing programmer in 20 hours!1111&#8243; books work? I must try this soon and let you know whether it works.</p>
<p><strong>Big up Pseudo Code</strong> &#8211; I don&#8217;t know if this is a universal thing, but my students hate using pseudo code. I suspect this is because it forces them to think about the inner workings of the algorithm rather than proudly presenting a syntactically correct print statement. I did a worksheet on <a href="http://codeboom.files.wordpress.com/2011/12/word_icon_small.jpg"><img class="alignnone size-full wp-image-32" title="word_icon_small" src="http://codeboom.files.wordpress.com/2011/12/pdf_icon_small.jpg?w=600" alt=""   /></a> <a href="http://codeboom.files.wordpress.com/2011/12/practicing-pseudo-code.pdf">Practicing Pseudo Code</a> last week to try to help students to write sensible pseudo code (they tend to write things like &#8220;decide which player goes first&#8221; instead of breaking it down into smaller tasks) which worked quite well, the students discussed the code in pairs before writing it down and comparing with others.</p>
<p>From my current experience, the parts of the exam which my students find the hardest are the &#8220;off piste&#8221; type questions which demand they write an algorithm that solves a given problem. This is what I shall be working on in preparation for the January modules.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/codeboom.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/codeboom.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/codeboom.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=codeboom.wordpress.com&amp;blog=30626418&amp;post=22&amp;subd=codeboom&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://codeboom.wordpress.com/2011/12/20/teaching-students-to-think/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/81a04dd6ac6ee7b2e2661487527d0374?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">codeboom</media:title>
		</media:content>

		<media:content url="http://codeboom.files.wordpress.com/2011/12/pdf_icon_small.jpg" medium="image">
			<media:title type="html">word_icon_small</media:title>
		</media:content>
	</item>
	</channel>
</rss>
