7 ms·
Looping has a huge advantage in terms of how we do things in real life. We don’t think of “pound 100 fence posts into the ground” recursively. Recursion is muc
by seanmcdirmid 7y ago
Looping has a huge advantage in terms of how we do things in real life. We don’t think of “pound 100 fence posts into the ground” recursively.
Recursion is much more of a mathematical concept that we learn about long after preschool, while my 3 year old already gets loops.
- jacksnipe 7y agoHonestly I'm going to disagree. Yes, when planning the task, I think about it as "I have to do this 100 times". But when I'm actually performing the task, I think "Ok, I have to get this stake in the ground, then proceed w/ the rest of my giant pile of stakes." On the flipside, I have a lot of mathematical training, so maybe this is an uncommon perspective.
- deleted 7y ago[deleted]
- loup-vaillant 7y ago> Looping has a huge advantage in terms of how we do things in real life. Anthropomorphism is the bane of our craft. Our untrained intuitions don't really matter. > Recursion is much more of a mathematical concept that we learn about long after preschool Programming is applied mathematics. Different from the kind of maths you learn at school of course, and often even more rigorous. I personally have no qualms about requiring some mathematical proficiency in programming. Makes you much more capable at a number of applications later on.
- jmilloy 7y ago> Our untrained intuitions don't really matter. On the contrary, we have no choice but to use our intutions, at whatever level of training they are at, all the time. So it matters a lot. If A is easier than B iff we learn to think differently, but learning to think differently is harder than just doing B, then A isn't actually easier than B.
- loup-vaillant 7y agoBecoming seriously proficient at anything seriously alters the way you think about it, no matter the field. For instance, I play the Cello. Lately, I noticed I only made progress when I understood something, or changed a habit, or let go of some subtle, but ultimately far reaching assumption. I played the Witness. There's a time based challenge at some point, that I could only beat when I changed the way I thought about those puzzle just so I could go through them faster. I learned to touch type. To do that, I stopped thinking visually, and instead think kinaesthetically. Then I developed some kind of intuition, where I think a word, and the letters just flow through my fingers. I don't really think at the letter level any more. Neither does anyone proficient with a keyboard. (50 WPM and up). Our untrained intuitions don't really matter. Seriously learning anything trains us out of them. Programming is no different.
- seanmcdirmid 7y agoPlenty of people learn how to program without learning the requisite math first. I wrote my first program when I was 8 years old, long before I learned even algebra. I think it is still the case that most people learn how to program before they even know what the word recursion means.
- shrimp_emoji 7y agoDo you think, in the future, programmers will be mathematicians in the same way that the blacksmiths of centuries ago are now chemical and material engineers in steel plants? Do you think this is the Bronze Age of artisinal craft, poised to be replaced by the dawn of brutally precise mechanized Haskell?
- seanmcdirmid 7y agoHumans are efficient, blacksmiths actually didn't become chemical and material engineers, my uncle spent his career working at an aluminum plant being useful without being an engineer. Many people will obtain just the necessary amount of knowledge and skill needed to accomplish their goals, which doesn't bode well for precise mechanized Haskell.
- greggman3 7y agoI have a huge problem with requiring mathematical proficiency in programming. It's sets an unreasonable barrier to entry. Thousands of every day apps and services work just fine without anything more than simple arithmetic. 3 or 4 of the top 5 websites required no math to get started. Spreading the idea that you need to know math before learning to program is elitist and counter productive IMO.
- andrepd 7y ago>It's sets an unreasonable barrier to entry. Maybe that's not such a bad thing? When a big chunk of our world runs on computers, maybe it's not such a bad thing to have standards and take things seriously, like it is done in every single other engineering profession.
- seanmcdirmid 7y agoSo we don't allow kids to learn how to program until they take a lot of requisite math first? I was planning on teaching my kid some programming when he turned 5 or so, but should I hold off until he is 15 because obviously he isn't going to know all of that math before hand? I believe that programming is a skill, not a profession. You can know how to program without being a professional programmer.
- RHSeeger 7y agoKids can learn how to build bridges out of legos and erector sets before they learn math and (intro to?) materials science and a host of other things. But we don't let them be civil engineers until they learn the basics of these things. It's entirely possible to learn about and "play with" something without the things that are considered prerequisites for being a professional at it.
- andrepd 7y agoWhat I was going to say. Yes little kids can learn to program, but I think 10 year old me and his shitty programs in Turbo Pascal aren't the standard we should be measuring professionals by.
- jasode 7y ago>Programming is applied mathematics. I didn't downvote your comment but your statement is a very misleading idea. Yes, the study of Computer Science is a discipline of mathematics but common programming done by most devs is not applied mathematics. Sure, if we really wanted to, we could say baseball is "applied calculus" because when an outfielder chases after a fly ball to intercept it, he's tracking an inverted parabola... and cooking is "applied physics" because of thermodynamics ... but insisting on that is just being pedantic and academic. People do not need calculus and physics classroom training to play baseball and cook food.
- User23 7y ago> Sure, if we really wanted to, we could say baseball is "applied calculus" because when an outfielder chases after a fly ball to intercept it, he's tracking an inverted parabola... and cooking is "applied physics" because of thermodynamics ... but insisting on that is just being pedantic and academic. People do not need calculus and physics classroom training to play baseball and cook food. No, we can't, because baseball and cooking aren't formal symbol manipulation, but both math and programming are. That is why all programming is applied mathematics, because it's all manipulating symbols in compliance with a set of formal rules. Observably, many programmers manage to achieve considerable success without much or any mathematical sophistication. This is because the market places relatively little value on correctness, which is what math helps with, and far greater value on pleasantness, which doesn't require mathematical sophistication at all.
- yowlingcat 7y agoI think that's a stretch. Programming is the creation and/or maintenance of software based solutions. Familiarity with the problem domain that needs to be solved involves keeping track of details that in many cases have little to do with mathematical proficiency and much more necessarily to do with bureaucracy. You need a certain kind of curiosity and general problem solving ability to get any further than mid level individual contributor that allows you to see around corners in terms of how large scale human socioeconomic systems function and think strategically. That's not to say that mathematical proficiency isn't indirectly useful -- I do think it's worthwhile in that it teaches a mind how to think in a structured manner and solve problems in a structured manner, and that process is useful and transferrable. But it only transfers so far. There are many challenges you face developing proficiency writing software that you cannot be prepared for in any other way than by using, building and studying software.
- rapind 7y agoI'm not so sure. Seems to me that often you want to pound fence posts into the ground 3 feet apart until you enclose the desired area.
- carapace 7y agoHmm, aren't all living things recursive? (BTW, big fan of your work!)
- svat 7y agoDonald Knuth has the opposite view: he thinks recursion is more fundamental. Funnily, he uses an example much like yours. > On the other hand, recursion is quite fundamental. It is not inherently a high-level concept, suitable only for grownups but not for children. Most people actually grew up with an implicit understanding of rudimentary recursion long before they understood iteration—that is, before they understood how to carry out a loop of instructions. Given a list of tasks to do, the simplest mode of operation is a recursive approach that charges blindly ahead: […] > It's only after we've gained experience with such an almost mindless method that we acquire a more global view of the process: > Do Jobs = Do each job on the list. (2) > […] > Do a_k for 1 ≤ k ≤ n. (5) > All computer programmers have in fact progressed from stage (1) to these later stages rather early in our lives, because of an inner desire to “see through” the entire chain of consequences that result from primitive actions. > Furthermore, once we reached these later stages, we entirely forgot that they were actually elaborations of the recursive procedure in (1). There was no point in narrowing our perspective to the simple-minded form. The vast majority of recursive situations that faced us as children fell into very simple patterns that could readily be “seen through” and understood as a unit. Thus we came to understand iteration as an elementary idea. > It was only later, when faced with difficult problems whose recursive structure cannot be visualized in straightforward terms such as operations on arrays of elements, that we re-learned the importance of recursion. Therefore we now tend to regard recursion as a high-level concept, although it is really fundamental. Possibly these views of his are influenced by his early background in programming in assembly/machine language, where it takes some sophistication to translate recursive ideas into code (maintaining a stack etc), but it's an interesting point of view worth some consideration. This is from his draft of TAOCP Chapter 8 ("Recursion"), and is preceded by the following paragraph: > High-level languages for computing—which themselves are de ned recursively, because algebraic formulas are built up from algebraic formulas—allow programmers to pretend that recursion is real, that a computer is somehow manufactured from recursive components. But programs that invoke themselves are actually implemented by means of a stack structure behind the scenes. A good programmer is able to understand such algorithms by viewing them simultaneously at a high level and at the machine level, and at many levels in between, thereby perceiving what a real computer can actually do well.
- deleted 7y ago[deleted]
- jbjohns 7y agoFrom a perspective of what we do in real life, I think looping and recursion are the same thing. Pound 100 fence posts into the ground is either "do this, then loop back and do it again until some stop point" (iterative) or "the base case is no posts left where you stop, otherwise pound the current posts into the ground" recursive. Recursive has the advantage that when you use the tools for it, recursive is easier to read. If I see e.g. a map, I know we're converting a collection of things to some other things without restriction. With a look, I just have to read through it to see what it's doing.