You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

319 lines
21KB

  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>
  11. <strong id="title">Open Game Studio</strong>
  12. <div id="lang">
  13. <a href="../../en/news/teaching-to-program-2019.html">EN</a>
  14. <a href="../../ru/news/teaching-to-program-2019.html">RU</a>
  15. </div>
  16. </div>
  17. <div class="header2">
  18. <div class="menu">
  19. <a href="../../en/news/index.html">News</a>
  20. <a href="../../en/game/index.html">Games</a>
  21. <a href="../../en/tool/index.html">Tools</a>
  22. <a href="../../en/page/about.html">About</a>
  23. </div>
  24. <a class="discord" href="https://discord.gg/3A6THQabNf">
  25. <img src="../../images/discord.png"></img>
  26. </a>
  27. <div class="clear"></div>
  28. </div>
  29. </div>
  30. <h3 class="left_item_title">In the news...</h3>
  31. <center>
  32. <div class="news_item">
  33. <h2 class="news_item_title">
  34. <a href="teaching-to-program-2019.html">Teaching folks to program 2019, a.k.a. in the search of an ideal program: Sequence</a>
  35. </h2>
  36. <p class="news_item_date">
  37. 2020-02-12 00:00
  38. </p>
  39. <div class="news_item_contents">
  40. <p><img src="../../images/2020-02-11_teaching-to-program-2019_screenshot.png" alt="MUROM" /></p>
  41. <p>In this article Michael shares his thoughts on teaching folks to program in 2019.</p>
  42. <p><strong>Preface</strong></p>
  43. <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>
  44. <p>I have the following goals for conducting such courses:</p>
  45. <ul>
  46. <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>
  47. <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>
  48. </ul>
  49. <p><strong>Game</strong></p>
  50. <p><img src="../../images/2020-02-11_teaching-to-program-2019_game.png" alt="Game" /></p>
  51. <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>
  52. <p><strong>Tool</strong></p>
  53. <p><img src="../../images/2020-02-11_teaching-to-program-2019_ide.png" alt="IDE" /></p>
  54. <p>When I was creating the tool, my guiding principle was <strong>unpretentiousness</strong> that manifests itself in the following:</p>
  55. <ol>
  56. <li>work under any operating system<ul>
  57. <li>development can be conducted under Linux, macOS, or Windows</li>
  58. <li>one can play the game on a PC, a tablet, or a smartphone</li></ul></li>
  59. <li>no need to configure anything: just open the link in a web browser and start working</li>
  60. <li>no need for the Internet: work locally if you want, there's no back-end</li>
  61. <li>the game is available to everyone<ul>
  62. <li>if you place a file on GitHub Pages, just share the link</li>
  63. <li>if you send the file over Skype, just open the file locally</li></ul></li>
  64. </ol>
  65. <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>
  66. <ol>
  67. <li>left area depicts the code of a selected module;</li>
  68. <li>middle area contains buttons to restart, save the project and manage modules;</li>
  69. <li>top right area contains result;</li>
  70. <li>bottom right area lists modules belonging to both IDE and the project.</li>
  71. </ol>
  72. <p>Since we only have a single HTML file, we should be able to run it in two modes:</p>
  73. <ol>
  74. <li>replay<ul>
  75. <li>default mode;</li>
  76. <li>just open the file;</li></ul></li>
  77. <li>editing<ul>
  78. <li>append <code>?0</code> symbols in the address bar.</li></ul></li>
  79. </ol>
  80. <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>
  81. <p><strong>The first classes</strong></p>
  82. <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>
  83. <ol>
  84. <li>find out the typing speed of students;</li>
  85. <li>demonstrate API of the tool.</li>
  86. </ol>
  87. <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>
  88. <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>
  89. <p><img src="../../images/2020-02-11_teaching-to-program-2019_cant-unsee.jpg" alt="Can't unsee" /></p>
  90. <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>
  91. <p><strong>Successful seventh class</strong></p>
  92. <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).
  93. 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>
  94. <p><img src="../../images/2020-02-11_teaching-to-program-2019_brainstorm.jpg" alt="Brainstorm" /></p>
  95. <p>The lines in Russian read:</p>
  96. <ul>
  97. <li>timer;</li>
  98. <li>tutorial;</li>
  99. <li>sounds;</li>
  100. <li>the camera should be farther;</li>
  101. <li>randomize;</li>
  102. <li>hearts (meaning lives);</li>
  103. <li>randomize after a failed matching attempt;</li>
  104. <li>exploding spheres;</li>
  105. <li>levels with different number of spheres;</li>
  106. <li>background.</li>
  107. </ul>
  108. <p>Let's look closer into the class.</p>
  109. <p><strong>Board</strong></p>
  110. <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>
  111. <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>
  112. <ul>
  113. <li>every student is accustomed to receiving information from the board; students know what to observe;</li>
  114. <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>
  115. <li>fixing individual errors becomes faster because most of them stem from negligence, i.e., typos made while copying the board contents.</li>
  116. </ul>
  117. <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>
  118. <ul>
  119. <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>
  120. <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>
  121. <li>students have to remember the code to copy it to the board;</li>
  122. <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>
  123. </ul>
  124. <p><strong>Sequence</strong></p>
  125. <p><code>последовательность</code> module of the game looks like this:</p>
  126. <p><img src="../../images/2020-02-11_teaching-to-program-2019_sequence.png" alt="Sequence" /></p>
  127. <p>The sequence allows to write an algorithm in the form of events and reactions:</p>
  128. <ul>
  129. <li>events (<code>начало</code> (<code>start</code>), <code>выбор</code> (<code>selection</code>), etc.) are lines without indentation;</li>
  130. <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>
  131. </ul>
  132. <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.
  133. The class had almost an empty <code>последовательность</code> module in the beginning; only events were present:</p>
  134. <p><img src="../../images/2020-02-11_teaching-to-program-2019_events.png" alt="Events" /></p>
  135. <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>
  136. <p><img src="../../images/2020-02-11_teaching-to-program-2019_board-events.jpg" alt="Board events" /></p>
  137. <p>We were searching for reactions in <code>память.реакции</code> module (<code>memory.reactions</code>):</p>
  138. <p><img src="../../images/2020-02-11_teaching-to-program-2019_reactions.png" alt="Reactions" /></p>
  139. <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>
  140. <pre><code class="javascript language-javascript">function ПроверитьОкончание(мир) // 1.
  141. {
  142. мир.состояние["скрыто сфер"] = 0; // 2.
  143. this.исполнить = function() // 3.
  144. {
  145. мир.состояние["скрыто сфер"] += 2; // 4.
  146. var скрыто = мир.состояние["скрыто сфер"]; // 5.
  147. var сфер = мир.состояние["сферы"].length; // 6.
  148. if (сфер == скрыто) // 7.
  149. {
  150. мир.события["конец"].уведомить(); // 8.
  151. }
  152. };
  153. }
  154. </code></pre>
  155. <p>The same code in English would look like this:</p>
  156. <pre><code class="js language-js">function CheckForEnding(world) // 1.
  157. {
  158. world.state["spheres hidden"] = 0; // 2.
  159. this.run = function() // 3.
  160. {
  161. world.state["spheres hidden"] += 2; // 4.
  162. var hidden = world.state["spheres hidden"]; // 5.
  163. var spheres = world.state["spheres"].length; // 6.
  164. if (spheres == hidden) // 7.
  165. {
  166. world.events["ending"].report(); // 8.
  167. }
  168. };
  169. }
  170. </code></pre>
  171. <p>Let's look closer:</p>
  172. <ol>
  173. <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>
  174. <li><code>state</code> contains variable data used for communication;</li>
  175. <li><code>settings</code> contain constants to configure functions;</li>
  176. <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>
  177. <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>
  178. <li><code>run</code> method is executed each time an event is reported.</li>
  179. <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>
  180. <li>Just a shorter alias for <code>spheres hidden</code> counter.</li>
  181. <li>Count the number of spheres at the playing field.</li>
  182. <li>Compare the number of spheres at the playing field with the number of hidden spheres.</li>
  183. <li>Report <code>ending</code> event if they are equal, i.e., if all spheres were hidden.</li>
  184. </ol>
  185. <p>Students took turns searching for functions in <code>память.реакции</code> module:</p>
  186. <ul>
  187. <li>a student looks for a function in the module (to simplify the process, I've split the functions with <code>// // // //</code> symbols);</li>
  188. <li>once a function is located, the student speaks the name of the function out loud and comes to the board;</li>
  189. <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>
  190. </ul>
  191. <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>
  192. <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>
  193. <ul>
  194. <li>a teacher asks, for example, which of the listed functions is suitable for event <code>начало</code></li>
  195. <li>if a student answers correctly, the student<ul>
  196. <li>comes to the board</li>
  197. <li>writes the reaction under the related event</li>
  198. <li>crosses corresponding function out of the listed functions</li></ul></li>
  199. </ul>
  200. <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>
  201. <p><img src="../../images/2020-02-11_teaching-to-program-2019_board-sequence.jpg" alt="Board sequence" />
  202. <img src="../../images/2020-02-11_teaching-to-program-2019_board-functions.jpg" alt="Board functions" /></p>
  203. <p>and in the tool:</p>
  204. <p><img src="../../images/2020-02-11_teaching-to-program-2019_sequence.png" alt="Sequence" /></p>
  205. <p><strong>The following classes</strong></p>
  206. <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>
  207. <pre><code class="js language-js">var кот = "9";
  208. console.log(кот);
  209. </code></pre>
  210. <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>
  211. <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>
  212. <p><strong>The last class</strong></p>
  213. <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>
  214. <p><img src="../../images/2020-02-11_teaching-to-program-2019_retro.jpg" alt="Retro" /></p>
  215. <p>The same table in English would look like this:</p>
  216. <table>
  217. <thead>
  218. <tr>
  219. <th>№</th>
  220. <th>+</th>
  221. <th>-</th>
  222. </tr>
  223. </thead>
  224. <tbody>
  225. <tr>
  226. <td>1</td>
  227. <td>Personalized ending screen</td>
  228. <td>Touchpad?</td>
  229. </tr>
  230. <tr>
  231. <td>2</td>
  232. <td>Working on PC</td>
  233. <td>Writing on the board</td>
  234. </tr>
  235. <tr>
  236. <td>3</td>
  237. <td>Explanation</td>
  238. <td>Discipline</td>
  239. </tr>
  240. <tr>
  241. <td>4</td>
  242. <td>Flexible learning program</td>
  243. <td>Sometimes unclear and uninteresting</td>
  244. </tr>
  245. <tr>
  246. <td>5</td>
  247. <td>There's a finished game</td>
  248. <td>Learning program is too big</td>
  249. </tr>
  250. <tr>
  251. <td>6</td>
  252. <td>A detailed explanation of algorithms</td>
  253. <td>Doing the same thing each time</td>
  254. </tr>
  255. <tr>
  256. <td>7</td>
  257. <td>Teamwork</td>
  258. <td>Students of disparate skill level</td>
  259. </tr>
  260. <tr>
  261. <td>8</td>
  262. <td>Interesting / Difficult</td>
  263. <td>Too early</td>
  264. </tr>
  265. <tr>
  266. <td>9</td>
  267. <td>Sequence</td>
  268. <td>Half of the course</td>
  269. </tr>
  270. </tbody>
  271. </table>
  272. <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>
  273. <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>
  274. <p>Nonetheless, each student had its own version of the game by the end of the course with personalized beginning and ending screens:</p>
  275. <p><img src="../../images/2020-02-11_teaching-to-program-2019_addr.jpg" alt="Addr" /></p>
  276. <p><strong>Conclusion</strong></p>
  277. <p>On the one hand, we had significant success:</p>
  278. <ul>
  279. <li>the tool worked as unpretentiously as expected;</li>
  280. <li>the concept of sequences was easily understood.</li>
  281. </ul>
  282. <p>On the other hand, we had an evident failure:</p>
  283. <ul>
  284. <li>the tool wasn't friendly to students without JavaScript knowledge, i.e., everyone;</li>
  285. <li>the teaching program has been stuck most of the time.</li>
  286. </ul>
  287. <p>That's why I'll try to answer the following questions when teaching in 2020:</p>
  288. <ol>
  289. <li>Will another language (Python, Lua) be simpler to explain and work with?</li>
  290. <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>
  291. <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>
  292. <li>How to explain variables and arrays?</li>
  293. </ol>
  294. <p>I'll share answers to these and other questions next year ;)</p>
  295. <p><img src="../../images/2020-02-11_teaching-to-program-2019_group.jpg" alt="Group" /></p>
  296. </div>
  297. </div>
  298. <div id="disqus_thread"></div>
  299. <script>
  300. var disqus_config = function () {
  301. this.page.url = "https://opengamestudio.org/en/news/teaching-to-program-2019.html";
  302. this.page.identifier = "teaching-to-program-2019.html";
  303. };
  304. (function() { // DON'T EDIT BELOW THIS LINE
  305. var d = document, s = d.createElement('script');
  306. s.src = 'https://opengamestudio.disqus.com/embed.js';
  307. s.setAttribute('data-timestamp', +new Date());
  308. (d.head || d.body).appendChild(s);
  309. })();
  310. </script>
  311. <noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
  312. <div id="footer">
  313. The site has been generated by <a href="http://opengamestudio.org/pskov">PSKOV</a>
  314. from <a href="http://github.com/ogstudio/site-opengamestudio">this source code</a>.
  315. </div>
  316. </center>
  317. </body>
  318. </html>