TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Reconsidering the way I explain programming (2020)

59 点作者 _7ffc将近 4 年前

12 条评论

joe_the_user将近 4 年前
The simplest analogy to programming is a recipe.<p><pre><code> Add X, Add Y, Do Z till Z is in Q state. </code></pre> So while&#x2F;for loop imo are really simple to get. Function calls are a bit harder but not much.<p>Accomplishing tasks with <i>recursion</i>? That&#x27;s utterly counter-intuitive imo. A given person can learn it but feels like a trick. Maybe a cool trick they&#x27;re cool for having learned and maybe a weird trick someone is pushing on them.<p>Recursive solutions to programming problems can be great once you get the whole idea but recursion is not an easy way to start people programming. It might not be a <i>bad</i> way - if you&#x27;re a highly committed 17 teen year old hot learn new things and willing to put in serious effort. learning LISP at MIT back when they taught is something would have like to have done. IE, Hard isn&#x27;t necessarily bad. But don&#x27;t expect people who want to put in minimal effort, who are terrified by just showing up to learning programming, to learn this hard way. And especially don&#x27;t expect them to appreciate that you decided to teach this way.<p>A lot of programming geeks are in denial about the inherent conceptual difficulty of functional programming (which isn&#x27;t even to say fp is bad, it has many virtues but easy for novices will never be one).<p>Edit: To put it in the author&#x27;s terms, there&#x27;s hierarchy of modalities and procedural processes are on the bottom and thus everyone can get them. Maybe 1-1 tutoring can different.
评论 #27979593 未加载
评论 #27980152 未加载
评论 #27981424 未加载
评论 #27981021 未加载
评论 #27979818 未加载
评论 #27979852 未加载
评论 #27983607 未加载
评论 #27980820 未加载
评论 #27979833 未加载
w1nter将近 4 年前
Author here. After reading the comments I’m afraid my article didn’t communicate the main point clearly. The mental models suggested here are sweet, but:<p>It’s not about how to explain recursion or programming, it’s about explaining abstract and complex concepts via adopting to the listener’s worldview and letting them experiment to evolve that view.
评论 #27980910 未加载
评论 #27988115 未加载
pmoriarty将近 4 年前
One of the best ways is to teach them the basics of Logo.<p><pre><code> to square forward 100 right 90 forward 100 right 90 forward 100 right 90 forward 100 end </code></pre> is a square.[1][2]<p>Then you can do:<p><pre><code> forward 100 square forward 100 square </code></pre> etc...<p>Any child can get this. I did when I was 10 years old, with a bunch of other pre-teens.<p>Got it right away and absolutely loved drawing various geometrical patterns.<p>Of course, Logo is based on Lisp, so you can go pretty deep with it.<p>[1] - Draw it for them as you explain it, or just show it directly on the computer using Logo and turtle graphics.<p>[2] - Pardon if my program has any bugs.. I&#x27;m doing this from memory.. haven&#x27;t touched Logo in decades...
评论 #27980119 未加载
Peritract将近 4 年前
I find that a lot of developers assume that a failed explanation is due to a lack of <i>precision</i>, and so they try and teach with long, detailed, overly-precise explanations.<p>Precise explanations are fantastic for people who already understand the concept: they let them go a level deeper and explore the underlying truth. However, they&#x27;re intimidating and unhelpful for people who have yet to grasp the concept.<p>For concepts, analogy works best - &#x27;code is like a...&#x27; along with minimal examples of ideas in accessible situations for your audience. Alice and Bob, etc.<p>Teaching code is about finding the right <i>metaphor</i> for your students - whether that&#x27;s recipes or language or robots or something else - not bashing at them with &quot;All told, a monad in X is just a monoid in the category of endofunctors of X, with product × replaced by composition of endofunctors and unit set by the identity endofunctor.&quot;
xorvoid将近 4 年前
This article demonstrates the key idea that I learned about teaching: the best teachers form-fit their teaching to the students specifically.<p>It’s your first job as a teacher to (1) listen and understand where your students mindset is, and then (2) teach from that mindset.<p>Using their vocabulary, their analogies, their interests, etc is super key.<p>I was a Graduate Student Instructor in college and I LOVED this because to me it was like a puzzle: (1) try to figure out where a student took a wrong turn when learning a complex topic, (2) take them back to the wrong turn and walk with them down the “right turn” until they finally have that lightbulb moment. The key to all of that was speaking&#x2F;explaining in <i>their</i> language, not mine.
amw-zero将近 4 年前
For me, there’s no better explanation possible than the description of software behavior in Specifying Systems by Leslie Lamport:<p>&gt; Formally, we define a behavior to be a sequence of states, where a state is an assignment of values to variables. We specify a system by specifying a set of possible behaviors—the ones representing a correct execution of the system.<p>Programming is creating an executable description of a set of possible sequences of states. Nothing more.<p><a href="https:&#x2F;&#x2F;lamport.azurewebsites.net&#x2F;tla&#x2F;book-02-08-08.pdf" rel="nofollow">https:&#x2F;&#x2F;lamport.azurewebsites.net&#x2F;tla&#x2F;book-02-08-08.pdf</a>
评论 #27979697 未加载
评论 #27979959 未加载
评论 #27979740 未加载
vbsteven将近 4 年前
This is similar to what I do but in my head the escalator goes down instead of up.<p>When editing (mostly C-like languages) I can &quot;see&quot; the execution thread pass through the code like a step-through debugger. At a function call I can mentally &quot;step into&quot; the function and the function is visualized to the right of the current function with its first line on the same height as the call site. Doing this for recursing functions means a visualization that progresses downwards and to the right.<p>I guess my mental model evolved this way after years of step-through debugging.<p>Mental models for code and other things are a fascinating topic. I also have a very specific calendar&#x2F;timeline model that is not a straight line at all. A full year &quot;view&quot; arranges months in a 2D layout where some months progress &quot;up&quot;, others &quot;down&quot; and they are connected in weird ways. For example 31&#x2F;01 and 01&#x2F;02 are adjacent, but 30&#x2F;11 and 01&#x2F;12 are not. 31&#x2F;12 is the last box of the year and is adjacent to 01&#x2F;01 repeating the pattern for the new year.
rmprescott将近 4 年前
&gt;Now I think I can explain tail call optimization via an escalator analogy.<p>Circular, &quot;Penrose Stairs&quot; (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Penrose_stairs" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Penrose_stairs</a>) might be a better extension to the student&#x27;s staircase model.
tedyoung将近 4 年前
Some basics of how people learn that I&#x27;ve found is:<p>* What do they know now (or think they understand)? You can only build knowledge on existing knowledge, so first find out what foundations exist (this connects to the author&#x27;s &quot;listener&#x27;s worldview&quot; idea).<p>* Tutoring (1-on-1) will almost always be better than teaching (1-to-many) because you can (if you try) better understand what&#x27;s being understood and what&#x27;s not.<p>* Learning is construction of desired knowledge, so learners have to &quot;do&quot; something and be provided quick feedback to build the desired concept (which is why learning on your own with little feedback is subject to learning the &quot;undesirable&quot; thing, even though it might have &quot;worked&quot; for you).<p>I did a talk on this topic (Human Learning) that you can find on YouTube (JitterTed.TV).
neatze将近 4 年前
My favorite programming explanation video;<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;Ct-lOOUqmyY" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;Ct-lOOUqmyY</a>
cryptonector将近 4 年前
&gt; Now I think I can explain tail call optimization via an escalator analogy.<p>Oh, that&#x27;s nice!
France_is_bacon将近 4 年前
I think the best way to explain a new concept is by analogy. Take something solid that everyone knows about and then explain it that way. It&#x27;s not 100% effective, but it is probably 80% effective that people will understand the broad underlying concept, then be able to fill in the dots on the remaining explanation. That&#x27;s because they have a framework on which to hang the sheetrock, the electrical sockets, put on the roof, etc. (see how I did that?)<p>That&#x27;s pretty much what happens when we are 4 or 5 years old and learning. You don&#x27;t teach a child 1+1=2, oh no. You take one rock, then a second rock, and ask them how many. The rock is one. &quot;1&quot; is not 1, and &quot;1&quot; + &quot;1&quot; is not &quot;2&quot;, because the young children don&#x27;t understand it that way. Then you put the number 1 next to each rock and add them, and eventually they understand. But it is very concrete. As adults, we don&#x27;t need the actual rocks, but we do need a known structure to compare things and assign the &quot;rock&quot; we know to the number &quot;1&quot;.<p>This applies to rote memory as well as understanding concepts. As an example how concreteness helps rote memory, let&#x27;s take the following list of 11 words: dog, cantaloupe, priest, hill, tornado, ocean, yellow, urn, fox, moon, mushroom.<p>Most people (not all) will not be able to memorize these abstract words&#x2F;ideas, even if familiar with them all. But if you match them with something more concrete, they will.<p>So instead of looking at the abstract words, just match each word with something more concrete in your imagination. So see in your mind&#x27;s eye this story, and the words you hve to memorize are in italics: A huge 20 foot German Shepard (<i>dog</i>), has a <i>cantaloupe</i> in his mouth and spits it out super hard and fast and it goes through the air like a cannonball and hits a <i>priest</i> who is standing on a big <i>hill</i>, and the priest rolls down to the bottom of a hill where a big <i>tornado</i> comes by at that instant and scoops him up and travels a little while to a big <i>ocean</i> that is bright <i>yellow</i>. Floating on the water is a huge 10 foot tall black and white striped <i>urn</i> and all of a sudden, a very sexy cartoon <i>fox</i> (<a href="https:&#x2F;&#x2F;cdn4.vectorstock.com&#x2F;i&#x2F;1000x1000&#x2F;03&#x2F;28&#x2F;fox-sexy-posing-vector-220328.jpg" rel="nofollow">https:&#x2F;&#x2F;cdn4.vectorstock.com&#x2F;i&#x2F;1000x1000&#x2F;03&#x2F;28&#x2F;fox-sexy-posi...</a>) comes out of the top and then shoots straight up out of the atmosphere at supersonic speed and goes up and lands on the <i>moon</i>, where the fox creates a big <i>mushroom</i> cloud when she lands.<p>If you imagine this story in great detail, you will have little problems memorizing those words and be able to say them all in order with ease. Even backwards order is easy. And this is almost always with 100% accuracy.<p>So it is the same thing when trying to teach someone an abstract idea for the first time, the exact same. Use concrete examples. Like the stairs in this guy&#x27;s example, that was great that he finally understands about using analogies.