{"id":3871,"date":"2009-07-15T08:00:10","date_gmt":"2009-07-15T12:00:10","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=3871"},"modified":"2023-12-16T13:22:43","modified_gmt":"2023-12-16T18:22:43","slug":"scratch","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=3871","title":{"rendered":"Scratch"},"content":{"rendered":"<p><a href=\"?p=3519\">A few weeks ago<\/a> I talked about learning programming, and I commented that I didn&#8217;t know what little kids were taught these days as a sort of &#8220;my first computing language&#8221;. At the time, I felt like kids should start with something linear and straightforward. <a href=\"http:\/\/scratch.mit.edu\/\">Scratch<\/a> has re-aligned my thinking on the matter.<\/p>\n<p>Scratch is an interesting programming language (or pseudo-language, depending on how pedantic we&#8217;re feeling today) that can be used to teach freshly weaned babes the intricacies of software engineering. Well, no. But it packs a lot of ideas into a fabulously simple and straightforward system.<\/p>\n<p><!--more-->In Scratch, you build your programs out of interlocking puzzle pieces. There are loops and conditionals, which contain a little opening (which expands as needed) to hold other pieces. It basically encapsulates the idea of curly braces. Conditional statements have a hexagonal hole, into which only a conditional test can be fitted. Conditional tests are hexagon-shaped pieces which have oval holes, into which only variables or numbers can be placed.<\/p>\n<p>The upshot is that it&#8217;s impossible to make a syntactically incorrect program. There is no way to make invalid code, which allows the would-be programmer to focus exclusively on structure and logic. It&#8217;s obvious how everything fits together, so the student gets a feel for program structure without needing to muck about with ideas like scope and indentation. Once they see the real thing (like, some C++ or some Python) they should be able to recognize and intuit what it does instead of seeing it as <a href=\"?p=461\">a big bunch of random symbols and crap<\/a>.<\/p>\n<p>The language is object-oriented and (this is the kicker) multi-threaded. You begin by dragging little clip art into your scene. You can use the prepackaged art, import your own, or draw something new using their editor, which is only slightly more robust than MS Paint. You can then edit the code for that specific object. You can have it move around, interact with other objects in the scene, respond to keyboard or mouse input, or passively wait for events triggered by other objects.<\/p>\n<p><table width='400'  cellpadding='0' cellspacing='0' border='0' align='right'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/scratch1.jpg' class='insetimage' width='400' alt='scratch1.jpg' title='scratch1.jpg'\/><\/td><\/tr><\/table>I fiddled around with and and was astounded at what you can do with it. There are a lot of very simple things you can&#8217;t do, but there are a lot of powerful things you <em>can<\/em> do.<\/p>\n<p>I made a very simple program that has two fish swimming around a scene. The larger, slower fish attracts to the smaller one, which zips around the scene in random arcs, bouncing off the edges as necessary. If the big one touches the small one, it &#8220;eats&#8221; the smaller fish and grows slightly larger. I also made some purely cosmetic transparent bubbles that float up the sceen, but only because I&#8217;m a slave to graphics spectacle.<\/p>\n<p>Simple stuff, really. Here is the code for the big fish:<\/p>\n<p><table   class=\"\" cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/scratch_code1.png' class='insetimage'   alt='scratch_code1.png' title='scratch_code1.png'\/><\/td><\/tr><\/table><\/p>\n<p>And here is the code for the little one:<\/p>\n<p><table   class=\"\" cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/scratch_code2.png' class='insetimage'   alt='scratch_code2.png' title='scratch_code2.png'\/><\/td><\/tr><\/table><\/p>\n<p>I have two daughters, ages nine and eleven. The youngest, Esther, is our dreamer. She devours books at an absurd pace. (We&#8217;re talking young-adult fantasy stuff here, not highbrow technical stuff.) She&#8217;s read more books at nine than I had by twenty. (Which isn&#8217;t <em>that<\/em> big a challenge, but still.) She draws and sings and creates stories and is completely uninterested in anything that might involve the use of numbers. She approached me a few weeks ago, wanting to know about programming.<\/p>\n<p>I suspected that she was only interested in the subject because she wanted to understand what I did all day. I was only too happy to humor her, figuring she would get bored and go back to reading books once she saw how dull code <em>is<\/em> compared to what <em>does<\/em>.<\/p>\n<p>After cramming a few basic ideas into her head (and some number theory, because she was attentive and I wanted to see what she&#8217;d do with it) I set her loose with Scratch and she went on a four-day programming bender.<\/p>\n<p>Things Scratch teaches:<\/p>\n<ol>\n<li>Object oriented design.<\/li>\n<li>Basic programming logic and understanding the flow of execution.<\/li>\n<li>The importance (or at least, utility) of setting initial values for variables.<\/li>\n<li>The difference between global and &#8220;member&#8221; variables.<\/li>\n<li>Programming is debugging.<\/li>\n<li>Programming is fun.<\/li>\n<\/ol>\n<p>I recommend Scratch to anyone who is curious about coding. Even adults. Sure, the clip-art stuff is kinda cheesy, but it&#8217;s easy to put a few bits together and make things happen. My daughters had a blast with it and they&#8217;ve never done anything remotely like coding before. I had fun with it and I&#8217;ve been coding <a href=\"?p=213\">in one form or another<\/a> since <a href=\"http:\/\/www.youtube.com\/watch?v=9whehyybLqU\">99 Luftballons<\/a> was on the charts.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few weeks ago I talked about learning programming, and I commented that I didn&#8217;t know what little kids were taught these days as a sort of &#8220;my first computing language&#8221;. At the time, I felt like kids should start with something linear and straightforward. Scratch has re-aligned my thinking on the matter. Scratch is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[66],"tags":[],"class_list":["post-3871","post","type-post","status-publish","format-standard","hentry","category-programming"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/3871","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3871"}],"version-history":[{"count":2,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/3871\/revisions"}],"predecessor-version":[{"id":56865,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/3871\/revisions\/56865"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}