No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

teaching-to-program-2019.html 21KB

hace 2 meses
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. <!DOCTYPE html>
  2. <html>
  3. <meta charset="utf-8">
  4. <head>
  5. <link rel="stylesheet" href="../../style.css">
  6. </head>
  7. <body>
  8. <script data-goatcounter="https://services.opengamestudio.org:443/count" async src="//services.opengamestudio.org:443/count.js"></script>
  9. <div id="header">
  10. <div class="header2">
  11. <div class="menu">
  12. <a href="../../en/news/index.html">News</a>
  13. <a href="../../en/game/index.html">Games</a>
  14. <a href="../../en/tool/index.html">Tools</a>
  15. <a href="../../en/page/about.html">About</a>
  16. </div>
  17. <div id="lang">
  18. <a href="../../en/news/teaching-to-program-2019.html">EN</a>
  19. <a href="../../ru/news/teaching-to-program-2019.html">RU</a>
  20. </div>
  21. <div class="clear"></div>
  22. </div>
  23. </div>
  24. <h3 class="left_item_title">In the news...</h3>
  25. <center>
  26. <div class="news_item">
  27. <h2 class="news_item_title">
  28. <a href="teaching-to-program-2019.html">Teaching folks to program 2019, a.k.a. in the search of an ideal program: Sequence</a>
  29. </h2>
  30. <p class="news_item_date">
  31. 2020-02-12 00:00
  32. </p>
  33. <div class="news_item_contents">
  34. <p><img src="../../images/2020-02-11_teaching-to-program-2019_screenshot.png" alt="MUROM" /></p>
  35. <p>In this article Michael shares his thoughts on teaching folks to program in 2019.</p>
  36. <p><strong>Preface</strong></p>
  37. <p>Autumn 2019 was the third time I participated as one of the teachers in the course to teach 10-15-year-old folks to program. The course took place from mid. September to mid. December. Each Saturday, we were studying from 10 AM to 12 PM. More details about the structure of each class and the game itself can be found in <a href="teaching-kids-to-program.html">the 2018 article</a>.</p>
  38. <p>I have the following goals for conducting such courses:</p>
  39. <ul>
  40. <li>create a convenient tool to allow the creation of simple games, the tool interested folks of 10 years old or older can master;</li>
  41. <li>create a program to teach programming, the program interested folks of 10 years old or older can use themselves to create simple games.</li>
  42. </ul>
  43. <p><strong>Game</strong></p>
  44. <p><img src="../../images/2020-02-11_teaching-to-program-2019_game.png" alt="Game" /></p>
  45. <p>Memory is a simple game we create during the course. The goal of Memory is to find matching items on a playing field. More details, including game mechanics, can be found in <a href="teaching-kids-to-program.html">the 2018 article</a>. You can play the created game in a web browser by clicking <a href="http://kornerr.ru/ekids2019">this link</a>.</p>
  46. <p><strong>Tool</strong></p>
  47. <p><img src="../../images/2020-02-11_teaching-to-program-2019_ide.png" alt="IDE" /></p>
  48. <p>When I was creating the tool, my guiding principle was <strong>unpretentiousness</strong> that manifests itself in the following:</p>
  49. <ol>
  50. <li>work under any operating system<ul>
  51. <li>development can be conducted under Linux, macOS, or Windows</li>
  52. <li>one can play the game on a PC, a tablet, or a smartphone</li></ul></li>
  53. <li>no need to configure anything: just open the link in a web browser and start working</li>
  54. <li>no need for the Internet: work locally if you want, there's no back-end</li>
  55. <li>the game is available to everyone<ul>
  56. <li>if you place a file on GitHub Pages, just share the link</li>
  57. <li>if you send the file over Skype, just open the file locally</li></ul></li>
  58. </ol>
  59. <p>The tool is an integrated development environment (IDE) that is technically a single HTML file. This single file contains both IDE and a project under development (Memory game in our case). The tool looks pretty standard:</p>
  60. <ol>
  61. <li>left area depicts the code of a selected module;</li>
  62. <li>middle area contains buttons to restart, save the project and manage modules;</li>
  63. <li>top right area contains result;</li>
  64. <li>bottom right area lists modules belonging to both IDE and the project.</li>
  65. </ol>
  66. <p>Since we only have a single HTML file, we should be able to run it in two modes:</p>
  67. <ol>
  68. <li>replay<ul>
  69. <li>default mode;</li>
  70. <li>just open the file;</li></ul></li>
  71. <li>editing<ul>
  72. <li>append <code>?0</code> symbols in the address bar.</li></ul></li>
  73. </ol>
  74. <p>Web browser cache (IndexedDB) is used to keep changes temporarily. To save changes permanently, one has to download the file with the changes by clicking the corresponding button in the middle area.</p>
  75. <p><strong>The first classes</strong></p>
  76. <p>I prepared <a href="http://kornerr.ru/ekids19?техника">80 lines of JavaScript code</a> for the first class and printed the code on paper. Each student received the paper and had to type the code into the tool. The typing exercise had the following goals:</p>
  77. <ol>
  78. <li>find out the typing speed of students;</li>
  79. <li>demonstrate API of the tool.</li>
  80. </ol>
  81. <p>The typing speed turned out to be extremely low: ranging from 14 symbols per minute (a student managed to type only half of the code) to 39 symbols per minute. Since I used to type the code with the speed of 213 symbols per minute, I was shocked by the results and started to doubt we would be able to write the game in an hour by the end of the course.</p>
  82. <p>We spent the second class to find typos in the code. I met typos that I have never seen in my life. I was shocked again: students had a hard time finding the typos even with the correct code on the paper in front of them. It's hard to imagine what would happen to the students' psyche if we were to pass a <a href="https://cantunsee.space/">brutal UX/UI test</a> with questions like this:</p>
  83. <p><img src="../../images/2020-02-11_teaching-to-program-2019_cant-unsee.jpg" alt="Can't unsee" /></p>
  84. <p>Later I tried to decrease the code down to 10 lines, offered partially completed code so that students could find and fix errors. Nothing helped: students just couldn't comprehend anything as if they saw hieroglyphs instead of familiar letters.</p>
  85. <p><strong>Successful seventh class</strong></p>
  86. <p>The half of the course was over, and I haven't moved an inch. In another attempt to find a way to explain the code I rewrote the game one more time. Now with a module of an intriguing title <code>последовательность</code> (<code>sequence</code> in Russian).
  87. To my surprise, the class had a stunning success: we got everything done before "the bell rang", and the students were burning with enthusiasm. The burning was so strong that we finished the class with a spontaneous brainstorm session where we came up with functionality to make the newly appeared game even better:</p>
  88. <p><img src="../../images/2020-02-11_teaching-to-program-2019_brainstorm.jpg" alt="Brainstorm" /></p>
  89. <p>The lines in Russian read:</p>
  90. <ul>
  91. <li>timer;</li>
  92. <li>tutorial;</li>
  93. <li>sounds;</li>
  94. <li>the camera should be farther;</li>
  95. <li>randomize;</li>
  96. <li>hearts (meaning lives);</li>
  97. <li>randomize after a failed matching attempt;</li>
  98. <li>exploding spheres;</li>
  99. <li>levels with different number of spheres;</li>
  100. <li>background.</li>
  101. </ul>
  102. <p>Let's look closer into the class.</p>
  103. <p><strong>Board</strong></p>
  104. <p>Previous classes were using "teachers work with each student individually" approach. After six classes we (two teachers) realized that diving into each student's specific typos/errors takes more time than teaching anything new.</p>
  105. <p>Starting with the seventh class, we decided to hook everyone to the board, i.e., the board became a central place where all of us were working, a place for everyone to stand up, approach the board and write there. PCs became secondary, a place for students to copy the board contents to. This practice clearly indicated school boards exist for many reasons:</p>
  106. <ul>
  107. <li>every student is accustomed to receiving information from the board; students know what to observe;</li>
  108. <li>teacher's environment is at the board; it's now possible to explain single new item to everyone without diving into individual errors;</li>
  109. <li>fixing individual errors becomes faster because most of them stem from negligence, i.e., typos made while copying the board contents.</li>
  110. </ul>
  111. <p>I'd like to highlight the fact that teachers work at the board together with students: a teacher sets direction; however, students stand up and come to the board themselves, write answers to the teacher's questions themselves. The benefits of such an approach are the following:</p>
  112. <ul>
  113. <li>students write with their own hands, i.e., they come up with a solution and implement it themselves, a teacher does not write for them;</li>
  114. <li>students stand up and come to the board, i.e., they move, which is good for health and drains unbridled energy that usually hampers discipline;</li>
  115. <li>students have to remember the code to copy it to the board;</li>
  116. <li>teachers have an opportunity to evaluate students' observation skills by seeing how easy (or hard) it is for them to remember and write the code on the board.</li>
  117. </ul>
  118. <p><strong>Sequence</strong></p>
  119. <p><code>последовательность</code> module of the game looks like this:</p>
  120. <p><img src="../../images/2020-02-11_teaching-to-program-2019_sequence.png" alt="Sequence" /></p>
  121. <p>The sequence allows to write an algorithm in the form of events and reactions:</p>
  122. <ul>
  123. <li>events (<code>начало</code> (<code>start</code>), <code>выбор</code> (<code>selection</code>), etc.) are lines without indentation;</li>
  124. <li>reactions (<code>настроить ThreeJS</code> (<code>configure ThreeJS</code>), <code>показать заставку</code> (<code>show splash screen</code>), etc.) are lines with indentation to signify their relation to events.</li>
  125. </ul>
  126. <p>Thus, when starting the game (<code>начало</code> event) we configure ThreeJS (<code>настроить ThreeJS</code> reaction), show splash screen (<code>показать заставку</code> reaction), and so on.
  127. The class had almost an empty <code>последовательность</code> module in the beginning; only events were present:</p>
  128. <p><img src="../../images/2020-02-11_teaching-to-program-2019_events.png" alt="Events" /></p>
  129. <p>I have duplicated these same events onto the board, leaving free space to add reactions later during the class (I used GIMP to depict free space in the following image):</p>
  130. <p><img src="../../images/2020-02-11_teaching-to-program-2019_board-events.jpg" alt="Board events" /></p>
  131. <p>We were searching for reactions in <code>память.реакции</code> module (<code>memory.reactions</code>):</p>
  132. <p><img src="../../images/2020-02-11_teaching-to-program-2019_reactions.png" alt="Reactions" /></p>
  133. <p>Each reaction of <code>последовательность</code> module is represented in <code>память.реакции</code> module by <a href="https://javascript.info/constructor-new">constructor functions</a>. For example, <code>проверить окончание</code> reaction (<code>check for ending</code>) has a uniquely corresponding <code>ПроверитьОкончание</code> function (<code>CheckForEnding</code>):</p>
  134. <pre><code class="javascript language-javascript">function ПроверитьОкончание(мир) // 1.
  135. {
  136. мир.состояние["скрыто сфер"] = 0; // 2.
  137. this.исполнить = function() // 3.
  138. {
  139. мир.состояние["скрыто сфер"] += 2; // 4.
  140. var скрыто = мир.состояние["скрыто сфер"]; // 5.
  141. var сфер = мир.состояние["сферы"].length; // 6.
  142. if (сфер == скрыто) // 7.
  143. {
  144. мир.события["конец"].уведомить(); // 8.
  145. }
  146. };
  147. }
  148. </code></pre>
  149. <p>The same code in English would look like this:</p>
  150. <pre><code class="js language-js">function CheckForEnding(world) // 1.
  151. {
  152. world.state["spheres hidden"] = 0; // 2.
  153. this.run = function() // 3.
  154. {
  155. world.state["spheres hidden"] += 2; // 4.
  156. var hidden = world.state["spheres hidden"]; // 5.
  157. var spheres = world.state["spheres"].length; // 6.
  158. if (spheres == hidden) // 7.
  159. {
  160. world.events["ending"].report(); // 8.
  161. }
  162. };
  163. }
  164. </code></pre>
  165. <p>Let's look closer:</p>
  166. <ol>
  167. <li>The function accepts <code>world</code> (dictionary) that is used by functions to communicate with each other. <code>world</code> consists of three regions (dictionary keys):<ul>
  168. <li><code>state</code> contains variable data used for communication;</li>
  169. <li><code>settings</code> contain constants to configure functions;</li>
  170. <li><code>events</code> contain <a href="https://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern">publishers</a> to be able to subscribe functions to events.</li></ul></li>
  171. <li>An instance of this constructor function is created with <code>new</code> operator while parsing <code>последовательность</code> module. Practically, everything outside of <code>run</code> method is considered to be part of the constructor body. In our case, we create <code>spheres hidden</code> variable to count hidden spheres.</li>
  172. <li><code>run</code> method is executed each time an event is reported.</li>
  173. <li>Since <code>check for ending</code> reaction is executed each time a user hides a pair of spheres, we increase <code>spheres hidden</code> counter by <code>2</code>.</li>
  174. <li>Just a shorter alias for <code>spheres hidden</code> counter.</li>
  175. <li>Count the number of spheres at the playing field.</li>
  176. <li>Compare the number of spheres at the playing field with the number of hidden spheres.</li>
  177. <li>Report <code>ending</code> event if they are equal, i.e., if all spheres were hidden.</li>
  178. </ol>
  179. <p>Students took turns searching for functions in <code>память.реакции</code> module:</p>
  180. <ul>
  181. <li>a student looks for a function in the module (to simplify the process, I've split the functions with <code>// // // //</code> symbols);</li>
  182. <li>once a function is located, the student speaks the name of the function out loud and comes to the board;</li>
  183. <li>the student writes the name down on the board to the list of found functions (students may use any means to remember the names except teacher's hints).</li>
  184. </ul>
  185. <p>Such an exercise also highlights who's actively tracking the functions and who's unable to find the next function when it's their turn.</p>
  186. <p>Once the names of all functions have been written on the board, we were mapping reactions (functions) to events in a similar fashion:</p>
  187. <ul>
  188. <li>a teacher asks, for example, which of the listed functions is suitable for event <code>начало</code></li>
  189. <li>if a student answers correctly, the student<ul>
  190. <li>comes to the board</li>
  191. <li>writes the reaction under the related event</li>
  192. <li>crosses corresponding function out of the listed functions</li></ul></li>
  193. </ul>
  194. <p>Once we have a more-or-less working set of reactions for an event it's time to transfer them from the board to student PCs. That way we managed to fill the board with reactions both on the board:</p>
  195. <p><img src="../../images/2020-02-11_teaching-to-program-2019_board-sequence.jpg" alt="Board sequence" />
  196. <img src="../../images/2020-02-11_teaching-to-program-2019_board-functions.jpg" alt="Board functions" /></p>
  197. <p>and in the tool:</p>
  198. <p><img src="../../images/2020-02-11_teaching-to-program-2019_sequence.png" alt="Sequence" /></p>
  199. <p><strong>The following classes</strong></p>
  200. <p>During the following classes, we were trying to create a new reaction and a corresponding constructor function. First, I tried to put a solution into heads quickly (providing complete lines of code); however, that didn't work. That's why we ended up with learning the following code, which took us several classes:</p>
  201. <pre><code class="js language-js">var кот = "9";
  202. console.log(кот);
  203. </code></pre>
  204. <p>Unfortunately, these two lines of code were hard to explain: students were confused with the concept of variables and their values. This wasn't the only problem: the new function required the use of an array, which I failed to explain at all. There's a long road ahead of me before I'm able to explain variables and arrays to students.</p>
  205. <p>Of course, by the end of the course we managed to complete the new function, however, I haven't seen understanding and subsequent faith in themselves, which usually manifests itself with a burning enthusiasm we saw in the seventh class.</p>
  206. <p><strong>The last class</strong></p>
  207. <p>The last class was not using the famous greeting circle at the beginning. Instead, I asked everyone (including myself) to tell what was good (+) and what was bad (-) during the course. Here's the table I got:</p>
  208. <p><img src="../../images/2020-02-11_teaching-to-program-2019_retro.jpg" alt="Retro" /></p>
  209. <p>The same table in English would look like this:</p>
  210. <table>
  211. <thead>
  212. <tr>
  213. <th>№</th>
  214. <th>+</th>
  215. <th>-</th>
  216. </tr>
  217. </thead>
  218. <tbody>
  219. <tr>
  220. <td>1</td>
  221. <td>Personalized ending screen</td>
  222. <td>Touchpad?</td>
  223. </tr>
  224. <tr>
  225. <td>2</td>
  226. <td>Working on PC</td>
  227. <td>Writing on the board</td>
  228. </tr>
  229. <tr>
  230. <td>3</td>
  231. <td>Explanation</td>
  232. <td>Discipline</td>
  233. </tr>
  234. <tr>
  235. <td>4</td>
  236. <td>Flexible learning program</td>
  237. <td>Sometimes unclear and uninteresting</td>
  238. </tr>
  239. <tr>
  240. <td>5</td>
  241. <td>There's a finished game</td>
  242. <td>Learning program is too big</td>
  243. </tr>
  244. <tr>
  245. <td>6</td>
  246. <td>A detailed explanation of algorithms</td>
  247. <td>Doing the same thing each time</td>
  248. </tr>
  249. <tr>
  250. <td>7</td>
  251. <td>Teamwork</td>
  252. <td>Students of disparate skill level</td>
  253. </tr>
  254. <tr>
  255. <td>8</td>
  256. <td>Interesting / Difficult</td>
  257. <td>Too early</td>
  258. </tr>
  259. <tr>
  260. <td>9</td>
  261. <td>Sequence</td>
  262. <td>Half of the course</td>
  263. </tr>
  264. </tbody>
  265. </table>
  266. <p>Surprisingly enough, the folks didn't like to write on the board even though it greatly increased the efficiency of teaching. On the one hand, the "learning program was too big", on the other hand, we were "doing the same thing each time", i.e. repeating what we have learned before.</p>
  267. <p>We were saving the game to GitHub from time to time. This was difficult, too: we were spending half an hour while students were authenticating. As always, nobody remembered their passwords (each time), others had to verify it's really them accessing GitHub account on a new device, which required access to e-mail, which sometimes belonged to parents (the folks had to call their parents).</p>
  268. <p>Nonetheless, each student had its own version of the game by the end of the course with personalized beginning and ending screens:</p>
  269. <p><img src="../../images/2020-02-11_teaching-to-program-2019_addr.jpg" alt="Addr" /></p>
  270. <p><strong>Conclusion</strong></p>
  271. <p>On the one hand, we had significant success:</p>
  272. <ul>
  273. <li>the tool worked as unpretentiously as expected;</li>
  274. <li>the concept of sequences was easily understood.</li>
  275. </ul>
  276. <p>On the other hand, we had an evident failure:</p>
  277. <ul>
  278. <li>the tool wasn't friendly to students without JavaScript knowledge, i.e., everyone;</li>
  279. <li>the teaching program has been stuck most of the time.</li>
  280. </ul>
  281. <p>That's why I'll try to answer the following questions when teaching in 2020:</p>
  282. <ol>
  283. <li>Will another language (Python, Lua) be simpler to explain and work with?</li>
  284. <li>Is it possible to hide Git inside the tool so that one could save the game to <a href="https://isomorphic-git.org/">Git without leaving the tool</a>?</li>
  285. <li>Is it possible to create API as declarative as <a href="https://www.hackingwithswift.com/quick-start/swiftui/what-is-swiftui">SwiftUI</a>?</li>
  286. <li>How to explain variables and arrays?</li>
  287. </ol>
  288. <p>I'll share answers to these and other questions next year ;)</p>
  289. <p><img src="../../images/2020-02-11_teaching-to-program-2019_group.jpg" alt="Group" /></p>
  290. </div>
  291. </div>
  292. <div id="disqus_thread"></div>
  293. <script>
  294. var disqus_config = function () {
  295. this.page.url = "https://opengamestudio.org/en/news/teaching-to-program-2019.html";
  296. this.page.identifier = "teaching-to-program-2019.html";
  297. };
  298. (function() { // DON'T EDIT BELOW THIS LINE
  299. var d = document, s = d.createElement('script');
  300. s.src = 'https://opengamestudio.disqus.com/embed.js';
  301. s.setAttribute('data-timestamp', +new Date());
  302. (d.head || d.body).appendChild(s);
  303. })();
  304. </script>
  305. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  306. <div id="footer">
  307. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  308. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  309. </div>
  310. </center>
  311. </body>
  312. </html>