{"id":87,"date":"2021-09-23T04:27:47","date_gmt":"2021-09-23T04:27:47","guid":{"rendered":"http:\/\/santiagodebus.com\/?p=87"},"modified":"2021-12-18T18:10:04","modified_gmt":"2021-12-18T18:10:04","slug":"how-to-teach-programming-online","status":"publish","type":"post","link":"https:\/\/santiagodebus.com\/?p=87","title":{"rendered":"How to teach programming in universities?"},"content":{"rendered":"\n<p><a href=\"http:\/\/santiagodebus.com\/?p=87&amp;preview=true\">Preview in new tab<\/a><\/p>\n\n\n\n<figure class=\"wp-block-pullquote is-style-solid-color\"><blockquote><p>The most fundamental thing about teaching is that the students are, by and large, not like you.<\/p><\/blockquote><\/figure>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<p>When you teach, try not to be too clever. People always want to know the latest. And we love to tell people the latest. The problem is that most people who ask for this haven\u2019t learned the foundational stuff. It\u2019s not just to show them something they have to understand.<br><strong>Education is what, when, and why to do things.<\/strong><br><strong>Training is how to do it.<\/strong><\/p>\n\n\n\n<p>But\u2026 don\u2019t show off. I mean, it\u2019s so tempting to show off to our colleague, to stand in front of a group of people and show them something:&nbsp;<em>\u201cLook, this is clever, you don\u2019t get it, right?. (That means I\u2019m smart)\u201d<\/em>. That is not good teaching.<\/p>\n\n\n\n<p>When you do it right, people come out and say:&nbsp;<em>\u201cugh, that was easy\u201d.<\/em><\/p>\n\n\n\n<p>We have to keep our egos in control, remembering that the purpose of the exercise is to teach somebody else something useful.<\/p>\n\n\n\n<p>Teach people how to do the basic things, teach people to do simple things. When you\u2019re illustrating a technique, don\u2019t use the most advanced algorithm you can find. The best example is the simplest example that illustrates a technique or a feature or something. In teaching, simplification is a really important thing.<\/p>\n<\/div><\/div>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container\">\n<figure class=\"wp-block-pullquote is-style-solid-color\"><blockquote><p>You can&#8217;t just lecture about programming<\/p><\/blockquote><\/figure>\n<\/div><\/div>\n\n\n\n<p><strong>There is never time to do the job right, but there is always time to fix it later.<\/strong><\/p>\n\n\n\n<p>Programming it&#8217;s a practical skill, I sometimes say:<br>Do you think you can learn tennis from a youtube video?<br>Do you think you can learn design without designing things?<br>Programming without writing code?<br>People do believe those things and that&#8217;s wrong.<\/p>\n\n\n\n<p><strong>Code:<\/strong><br>Don&#8217;t separate code from explanation, if you just show the code, people will not get the idea and they will invent reasons why it looks like that and those reasons are sometimes seriously weird.<\/p>\n\n\n\n<p>On the other hand, if you give them just the explanation, they don&#8217;t get the idea.&nbsp;<em>So, tight integration between examples and explanation is essential.<\/em><\/p>\n\n\n\n<p><em><br>  <\/em><br><strong> Always give reasons:<\/strong><\/p>\n\n\n\n<p>In the next example, <strong>why is [2] better than [1]?<\/strong><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><span class=\"has-inline-color has-black-color\">1.<\/span>\nint len = v.size();\nfor(int i=0; i&lt;len; i++) ...\n\n<span class=\"has-inline-color has-black-color\">2.<\/span>\nfor(auto x:v) ...<\/code><\/pre>\n\n\n\n<p><br><em>Reason: [2] directly states the intent of the code<\/em><\/p>\n\n\n\n<ul><li>Can easily be changed to use an algorithm<\/li><li>is shorter, gives less oportunities for errors<\/li><\/ul>\n\n\n\n<p><em>Note: [1] is more general, can express more cases. That&#8217;s why we avoid it.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<figure class=\"wp-block-pullquote is-style-solid-color\"><blockquote><p>Better code<\/p><\/blockquote><\/figure>\n\n\n\n<p>22 years ago, after almost 10 months of travel to Mars, the $125 million Mars Climate Orbiter burned down and broke into pieces because someone failed to use the right units<\/p>\n\n\n\n<p>Teach good practices, eg.<strong> make interfaces precisely and strongly typed.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void blink_led1(int time_to_blink){ \n\n<span style=\"color:#545454\" class=\"has-inline-color\">   \/\/ bad - the unit is ambiguous<\/span>\n\n}\n\n\nvoid blink_led2(milliseconds time_to_blink) {\n   \n<span style=\"color:#545454\" class=\"has-inline-color\">   \/\/ good - the unit is explicit<\/span>\n\n}\n\nblink_led2(1000) <span style=\"color:#545454\" class=\"has-inline-color\">\/\/fail<\/span>\nblink_led2(1000ms) <span style=\"color:#545454\" class=\"has-inline-color\">\/\/good<\/span>\n<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Preview in new tab The most fundamental thing about teaching is that the students are, by and large, not like you. There is never time to do the job right, but there is always time to fix it later. Programming it&#8217;s a practical skill, I sometimes say:Do you think you can learn tennis from a [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[9,7],"_links":{"self":[{"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/posts\/87"}],"collection":[{"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=87"}],"version-history":[{"count":126,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=\/wp\/v2\/posts\/87\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/santiagodebus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=87"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=87"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/santiagodebus.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=87"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}