<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">
    <channel>
        
        <title>
            <![CDATA[ Philosophy - freeCodeCamp.org ]]>
        </title>
        <description>
            <![CDATA[ Browse thousands of programming tutorials written by experts. Learn Web Development, Data Science, DevOps, Security, and get developer career advice. ]]>
        </description>
        <link>https://www.freecodecamp.org/news/</link>
        <image>
            <url>https://cdn.freecodecamp.org/universal/favicons/favicon.png</url>
            <title>
                <![CDATA[ Philosophy - freeCodeCamp.org ]]>
            </title>
            <link>https://www.freecodecamp.org/news/</link>
        </image>
        <generator>Eleventy</generator>
        <lastBuildDate>Tue, 16 Jun 2026 11:53:50 +0000</lastBuildDate>
        <atom:link href="https://www.freecodecamp.org/news/tag/philosophy/rss.xml" rel="self" type="application/rss+xml" />
        <ttl>60</ttl>
        
            <item>
                <title>
                    <![CDATA[ Logical Fallacies – Definition and Fallacy Examples ]]>
                </title>
                <description>
                    <![CDATA[ When you're debating someone, you want to use all the resources at your disposal to convince them you're right. And that's great – but you should be careful that you don't end up using a logical fallacy to help you make your point. What is a Logical ... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/logical-fallacies-definition-fallacy-examples/</link>
                <guid isPermaLink="false">66b1fa5501079c4f2679de8e</guid>
                
                    <category>
                        <![CDATA[ logic ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ politics ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Abigail Rennemeyer ]]>
                </dc:creator>
                <pubDate>Wed, 23 Jun 2021 04:19:00 +0000</pubDate>
                <media:content url="https://www.freecodecamp.org/news/content/images/2021/05/fallacies-cover-image.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>When you're debating someone, you want to use all the resources at your disposal to convince them you're right.</p>
<p>And that's great – but you should be careful that you don't end up using a logical fallacy to help you make your point.</p>
<h2 id="heading-what-is-a-logical-fallacy">What is a Logical Fallacy?</h2>
<p>A logical fallacy is an error in reasoning that makes your argument less effective and convincing. And you want to be able to spot these fallacies in other people's arguments (and your own) so you can call them out or fix your own strategy.</p>
<p>There are two major types of logical fallacies, formal and informal.</p>
<p>In formal fallacies, there's a problem with <strong>how</strong> you structure your argument, and how you're making your points. You might be speaking the truth, but the logic breaks down because of the way you're putting your arguments together.</p>
<p>In informal fallacies, there's a problem with <strong>what</strong> you're saying, and the information might be incorrect or misleading. </p>
<p>In this article, we'll focus on these informal fallacies as they can be pretty common in everyday debate. And keep in mind that we're not talking about the effectiveness or persuasiveness of your argument, here – after all, fallacious arguments can be very persuasive.</p>
<p>Instead, it's all about giving you the tools to identify these weak arguments so you don't make these mistakes in your reasoning.</p>
<h2 id="heading-list-of-logical-fallacies-with-examples">List of Logical Fallacies with Examples</h2>
<p>In this article, we'll look at the most common informal fallacies so you can learn to identify them and avoid them.</p>
<h2 id="heading-the-sunk-cost-fallacy-definition-and-example">The Sunk Cost Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/sunk-cost-fallacy.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Have you ever finished a task (that you really didn't want to complete) simply because you'd put so much time and effort in already? You probably felt like you didn't want all that hard work to go to waste, or to be for nothing.</p>
<p>You were likely falling prey to the sunk cost fallacy. It states that it's actually better to abandon a project that's going nowhere (at any point) rather than waste any more time, energy, and resources trying to finish it for the sole purpose of finishing it.</p>
<p>The reason for this might seem counterintuitive, but think about it: rather than spend another minute of your precious time doing something that isn't going anywhere, it's better to switch gears ASAP (before you spend any <em>more</em> time) and start putting your energy into something productive.</p>
<h3 id="heading-example-of-a-sunk-cost-fallacy">Example of a Sunk Cost Fallacy</h3>
<p>Let's say that you've decided to write a book. You spend hours and hours doing research, making an outline, and writing the first 10 chapters. You've put months if not years of your life into writing this book.</p>
<p>But then perhaps your interests change, or you no longer wish to be an author. You might think you should finish the book because you're <em>so close</em> or because you've already spent so much time and energy on it. </p>
<p>Instead, though, you should leave that project behind and focus on what's ahead. Maybe you're trying to get a new job, or learn a new skill, or move to a new city. Any of these current and relevant initiatives would suffer if you continued to work on your unsuccessful book project.</p>
<p>So how do you distinguish between this sunk cost fallacy and persevering until you finish something difficult? Well, it helps to think about whether the experience will benefit you in the long run – in which case, it would be helpful to see it through. </p>
<p>For example, let's say you've done three years of a four year degree program at a college or university. But your interests have changed, and you want to pursue something that doesn't require that degree. </p>
<p>Still, it might make sense to finish the program, as a college degree typically only helps you in future career moves – not to mention the life experience you'll gain in the process.</p>
<h2 id="heading-the-ad-hominem-fallacy-definition-and-example">The Ad Hominem Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/ad-hominem-fallacy.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Ad hominem means "against the person" in Latin. So the ad hominem fallacy happens when you attack a person's character, appearance, personality, or other irrelevant aspects in an argument instead of attacking what they're saying.</p>
<p>These types of attacks are fallacious because they're not relevant to the argument, and so they distract from the point at hand. It doesn't really matter if you think your mom is being a jerk – she's still right that you shouldn't speed while driving.</p>
<h3 id="heading-example-of-an-ad-hominem-fallacy">Example of an Ad Hominem Fallacy</h3>
<p>Many people associate ad hominem fallacies with political debates. Unfortunately, some candidates don't seem to be able to help themselves. </p>
<p>What if Candidate A said that you shouldn't trust Candidate B because Candidate B doesn't dress well? There's no established link (that I know of!) connecting a "good dresser" with trustworthiness or good political decision-making, so this would be an ad hominem fallacy.</p>
<p>Or what about when Candidate A insults Candidate B for being too nerdy, or not cool enough? These qualities, first of all, are subjective, and second, they shouldn't affect Candidate B's ability to govern effectively.</p>
<p>On the other hand, sometimes people just deliver insults that aren't actually logical fallacies because they aren't part of the argument. For example, if you were to say that all New Yorkers are rude and unfriendly (but you aren't trying to make a point), that's just an (untrue) insult and not a fallacy.</p>
<p>So when you're debating someone, leave their personal characteristics out of it unless they're relevant to your point.</p>
<h2 id="heading-the-straw-man-fallacy-definition-and-example">The Straw Man Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/strawman-fallacy.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When you hear the term "straw man", what comes to mind? Probably a figure of a person made of straw, like a scarecrow, or something else insubstantial. That straw figure isn't too solid, and you could just knock it over with a little push or a strong gust of wind.</p>
<p>The same holds true for straw man fallacies – they represent weaker arguments that are oversimplified or that distract from the main point the debater is trying to make. </p>
<p>So instead of responding to someone with a well-reasoned, to-the-point counterargument, someone using a straw man might reframe that person's argument in a vastly oversimplified way, or might latch on to an irrelevant point that's tangentially related and go after that. Basically, they create a "straw man" in place of a real argument.</p>
<h3 id="heading-example-of-a-straw-man-fallacy">Example of a Straw Man Fallacy</h3>
<p>Perhaps you're discussing education with someone who believes that for-profit colleges are harmful to the broader educational system because they take advantage of their students, don't provide them high-quality education, and waste students' money.</p>
<p>Instead of responding with appropriate counterpoints (such as concrete examples of for-profit colleges who benefit their students), you try to undermine the person's argument by saying "See, they're against higher education and don't think people should go to college!"</p>
<p>In fact, the person has a much more nuanced claim, but you've ignored it and constructed a vague straw man fallacy in response.</p>
<p>Or maybe you're trying to figure out a solution to the number of people living without homes in your area. You might suggest setting up temporary (or permanent) tiny homes for houseless individuals, allocating resources for trash cleanup, and providing medical care during the pandemic.</p>
<p>Your opponent, however, might misconstrue your argument and insist that you're trying to welcome the homeless community to your area by providing so many benefits for them.</p>
<h2 id="heading-the-false-dilemma-fallacy-aka-the-false-dichotomy-fallacy-definition-and-example">The False Dilemma Fallacy (AKA The False Dichotomy Fallacy) – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/06/false-dichotomy-pic-2.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Have you ever argued with someone and they only give you two options when you feel like there are many more? Chances are they were falling into the trap of the false dichotomy.</p>
<p>Using a false dichotomy or false dilemma in an argument means that you oversimplify your argument or only focus on two outcomes when in fact there are other reasonable possibilities. </p>
<p>This strategy tries to hide important facts and considerations and tries to trick your opponent into thinking the argument is more cut and dry or simpler than it really is.</p>
<h3 id="heading-example-of-a-false-dilemma-fallacy">Example of a False Dilemma Fallacy</h3>
<p>Let's say that you're still working on finding homes for houseless people in your community. You might suggest a range of housing options, such as tiny houses, community living, repurposing empty apartment buildings, and so on. </p>
<p>You could also offer to relocate people who wished to leave your area, or you could help them find jobs so they could afford their own home eventually.</p>
<p>Someone opposed to your efforts might say that houseless people either need to get a job so they can afford their own place or leave town. And they wouldn't offer any of the other options you explored. </p>
<p>To someone uninformed about the crisis of homelessness in your area, those two options might sound reasonable. But to someone who had studied the issue extensively, it would be clear that those extremes weren't the only options.</p>
<p>How about another example?</p>
<p>Maybe you're at a political debate and one of the candidates asserts that you're either a Democrat or you're a Republican in an effort to make some point.</p>
<p>In reality, though, this likely wouldn't be the case. Certain people in attendance could be Libertarians, for example – but the politician didn't include that as an option.</p>
<p>So keep in mind, when you're making an argument, that there are likely many nuances that relate to your point. Don't ignore them – simply take them into account and build them into your argument.</p>
<p>Do keep in mind, though, that some arguments really only do have two viable options – so they wouldn't represent false dichotomies. For example, if a General says "Either you're with us or you're against us" during a war, those are the two main options.</p>
<h2 id="heading-the-slippery-slope-fallacy-definition-and-example">The Slippery Slope Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/slippery-slope.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>The slippery slope fallacy refers to arguments that get increasingly dramatic and out of hand very quickly. Especially when the ever-more-dramatic conclusions aren't realistic or likely to happen.</p>
<p>These types of arguments are often made when someone wants to emphasize how drastically bad an outcome would be.</p>
<p>Perhaps a better name for this fallacy, though, would be the Domino Effect – one thing <em>might</em> lead to another which <em>might</em> lead to another which might...and so on. The problem with these assumptions is that they're all hypothetical, which makes your overall claim very weak.</p>
<h3 id="heading-example-of-a-slippery-slope-fallacy">Example of a Slippery Slope Fallacy</h3>
<p>Perhaps your teenager wants to buy themselves a truck. They've been saving up, and they have the money. But you don't want them to drive a truck, for any number of reasons – perhaps you're worried about gas mileage, or parking in a city, or that they'll take it off-roading and get hurt.</p>
<p>Now, these are all fairly reasonable arguments as to why you wouldn't want your kid driving a truck, and they could easily result from that purchase.</p>
<p>But what if, instead of these sensible arguments, you let your emotions get away with you and instead said "You can't get a truck because then all your friends will want trucks and their whole families will then get trucks which they'll start driving all over the place and over-polluting the earth!"</p>
<p>You can see how that escalated quickly, right? And even though the arguer has a point about emissions in general here, it's probably not a realistic outcome of this situation (and it's probably not an effective argument to use to convince your teen not to buy a truck).</p>
<h2 id="heading-the-circular-reasoning-fallacy-definition-and-example">The Circular Reasoning Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/circular-reasoning.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Have you ever noticed someone arguing in a way that they seem to go around in a circle? It might seem like they're making an argument, but they'll use their conclusion to justify their argument, and their argument to justify their conclusion.</p>
<p>If this sounds confusing, that's because it is. When someone says something like "This tee-shirt is wet because it's covered in water," they're making a fallacious argument. In fact, the tee-shirt is wet <em>because you fell in a lake</em>, for example.</p>
<p>In this case, someone saying something's wet because it's covered in water is just stating the obvious. They're not offering an explanation for <em>why</em> it's that way.</p>
<p>You can often recognize a circular argument when the conclusion – the thing the person is arguing in favor of (or against) – is also one of the premises (or arguments) they're using to justify their assertion (it's wet because of water, which is wet). In other words, if this is true because that is true, that is true because this is true.</p>
<h3 id="heading-example-of-a-circular-reasoning-fallacy">Example of a Circular Reasoning Fallacy</h3>
<p>So here's another example: you say that your friend Jessie lies all the time, and you know this because they never tell the truth. But your argument (that Jessie lies all the time) and your premise (because they never tell the truth) are the same thing. That means that this is a circular argument.</p>
<p>Here's another way to think about it: if your argument's premises assume that your conclusion is true right from the beginning, rather than proving or finding that it's true, you're arguing in a circle. Just remember: if your argument is defined in terms of itself, it is probably fallacious.</p>
<p>And if you want to know why it's sometimes called "Begging the Question," you can <a target="_blank" href="https://en.wikipedia.org/wiki/Begging_the_question">read all about it here</a>. (Hint: it's a mistranslation of 16th century Latin that was actually a mistranslation of the ancient Greek phrase...fascinating.)</p>
<h2 id="heading-the-equivocation-fallacy-definition-and-example">The Equivocation Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/equivocation-fallacy.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Equivocation means that you're taking a word or phrase and changing its meaning slightly so that it means something else. Or you're using one word or phrase instead of another to hide the true meaning of what you're saying.</p>
<p>In other words, you're being ambiguous with your language. If something is ambiguous, it means that you can interpret it in more than one way or that it has two meanings. This is exactly what happens in an equivocation fallacy.</p>
<p>The word "equivocation" comes from the Latin for "equal voice" – meaning that it appears that what you're saying means one thing but it really means or can also mean something else. </p>
<p>The important thing to remember about equivocation fallacies is that they attempt to <strong>deceive</strong> in some way. </p>
<p>You might jokingly use ambiguity in a story, play, or playful conversation – but you're not really trying to convince your listener of something serious (or it's clear that you're being tricky or silly).</p>
<p>But when you use equivocation in a serious debate, political campaign, advertisement, or something similar, that's when it's more malicious and fallacious.</p>
<h3 id="heading-example-of-an-equivocation-fallacy">Example of an Equivocation Fallacy</h3>
<p>So how do you tell the difference? Be mindful of the setting in which you use ambiguous language, or you see it being used.</p>
<p>Here's a simple example: "Nine out of ten dentists recommend Colgate toothpaste." First of all, what does "recommend" mean here? This could be misleading – do they really specifically recommend Colgate, or do they just recommend that you brush your teeth in general? </p>
<p>How about another example? What if you break up with someone, and they ask you never to drive by their house again. So you walk by – but you justify it by saying that you didn't drive by. You walked.</p>
<p>Clearly your ex meant that they didn't want you going by their house in any way, but you used the ambiguity of the situation to tweak their words and do it anyway.</p>
<h2 id="heading-the-post-hoc-fallacy-definition-and-example">The Post Hoc Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/post-hoc-fallacy.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You might have heard the phrase "post hoc ergo propter hoc" before, even if you've never studied Latin.</p>
<p>This Latin phrase translates to "After this, therefore because of this." Now that might sound like a jumble of conjunctions and such, but it basically means that if event B happened after event A, that must mean that event A caused event B. </p>
<p>Post hoc ergo propter hoc → (B is) After this (A), therefore (B is) because of this (A). </p>
<p>This fallacy says that because one thing happened after another, it means that the first thing <em>caused</em> the second thing happen. The argument is a fallacy when someone asserts something based purely on the order that things happened. This means they're not taking into account other factors that affected or caused the event to happen.</p>
<p>If this sounds a bit familiar to you, it means you might have thought about <a target="_blank" href="https://www.freecodecamp.org/news/why-correlation-does-not-imply-causation-the-meaning-of-this-common-saying-in-statistics/">correlation vs causation</a> before. The post hoc fallacy is related, but is more focused on the order of events (and their relationship).</p>
<h3 id="heading-example-of-a-post-hoc-fallacy">Example of a Post Hoc Fallacy</h3>
<p>Let's look at an example to help decipher what's going on in this type of fallacious argument.</p>
<p>Maybe there was an earthquake during which a building fell down. That's a pretty clear example of causality – the earthquake (event A) caused the building to fall down (event B).</p>
<p>But what if, after that same earthquake, a lot of people moved away from the city? Now, some of them might have moved because the earthquake was the last straw. But many might have fled because of rising housing costs, pollution, over-crowding, poor infrastructure, poor schools, or a bunch of other factors. </p>
<p>In other words, the earthquake likely wasn't the only direct cause of people moving away.</p>
<p>So anyone who argued "Look, people are moving out of the city because of the earthquake!" and didn't account for all these other likely causes was making a fallacious argument.</p>
<p>Here's another example: perhaps you're searching for a job, and you're not having any luck. But then someone gives you a good luck charm, and after a few more applications, you get a job.</p>
<p>You might be tempted to think that the good luck charm got you the job. But what's more probable is that you put a lot of effort into your applications, you studied really hard for your interviews, and you found your perfect company fit.</p>
<h2 id="heading-the-appeal-to-authority-fallacy-aka-argumentum-ad-verecundium-fallacy-definition-and-example">The Appeal to Authority Fallacy (AKA Argumentum ad Verecundium Fallacy) – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/appeal-to-authority.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When you're gathering evidence to support your conclusion, you'll likely want to cite some experts. They've done research on the subject and know a lot about it, so it makes sense to use their knowledge and opinions to support your own arguments.</p>
<p>But be careful – if you don't use those expert's information correctly, or if you assume they're always right because they're experts, you could be falling prey to the appeal to authority fallacy.</p>
<p>An appeal to authority fallacy is easy to commit, but can be hard to recognize. This is because of the weight we all give to "authorities" in various subjects. </p>
<p>When you're engaging in an appeal to authority fallacy, you're likely either misusing someone's authority, citing an irrelevant authority, or citing a poor authority. </p>
<p>Let's see what these look like with some examples.</p>
<h3 id="heading-example-of-an-appeal-to-authority-fallacy">Example of an Appeal to Authority Fallacy</h3>
<p>Let's say your mom's a lawyer and you seek her advice about a particular legal problem you have. If she practices that type of law and has experience with the problem you're having, you can likely cite her authoritative opinion with confidence.</p>
<p>But if you're arguing with your mom about the best way to save the sea turtles, and she asserts that she knows best because she's an intelligent person, she's using her own authority in a fallacious way (and with little to no justification). </p>
<p>Here's another example. Perhaps you watch a lot of Greenbay Packers football, and Aaron Rogers is your favorite quarterback. You happen to see a State Farm insurance commercial where Aaron endorses State Farm's services. You might think, "Well, I like Aaron Rogers, and he recommends State Farm, so it must be great insurance!"</p>
<p>While State Farm might be great insurance, Aaron Rogers doesn't have the authority to say so. He's an authority on being a great quarterback, but not on the quality or efficacy of insurance. So this is an example of an irrelevant appeal to authority. </p>
<p>So, when you're searching for evidence to back your claim, just remember – authorities aren't the only sources you should cite. </p>
<p>And you shouldn't just expect people to trust what those experts say with no evidence. After all, even the experts can be wrong, and just because they know a lot about one thing doesn't mean they know a lot about everything.</p>
<h2 id="heading-the-appeal-to-ignorance-fallacy-definition-and-example">The Appeal to Ignorance Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/pexels-mathias-pr-reding-5662219.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>No one knows everything – it's just a fact of being human. We're all still learning, and while some might know more than others, we'll all be ignorant about certain things.</p>
<p>With that in mind, it's pretty easy to see why the appeal to ignorance fallacy is so common and so useless.</p>
<p>When you say something like "Well, no one's ever seen Nessie (the Loch Ness Monster) before, so they can't prove that she's real", you're making an appeal to ignorance. Why? Because no one knows whether she exists or not – because they've never seen her!</p>
<p>But the clearest way you can tell this is an appeal to ignorance fallacy is that you can turn it right around, and it still seems to make sense: "Well, no one's ever seen Nessie before, so they can't prove that she's not real!" </p>
<p>Either way, in both these claims, you're making an assertion <strong>based on something no one knows</strong> (the ignorance bit). Because no one knows it, you shouldn't use it in an argument.</p>
<h3 id="heading-example-of-an-appeal-to-ignorance-fallacy">Example of an Appeal to Ignorance Fallacy</h3>
<p>Let's look at another example of an appeal to ignorance fallacy in action.</p>
<p>Perhaps you're an archaeologist who's studying an ancient civilization that lived around 2000 years ago. You study any remaining stone structures, pottery, tools, jewelry, and anything else they left behind.</p>
<p>You try to piece together what life would've looked like for these people based on their artifacts, where they lived, nearby societies, and so on. But you have no written evidence that tells you anything more. No one has found any inscriptions, written documents, or anything else with writing on it.</p>
<p>It would be tempting to assert that, since no one has ever found any evidence of writing, this society didn't have a written language. "We've never found documents or inscriptions, so they must not have written their language down."</p>
<p>But you could also assert that, even though no one has found those documents <strong>yet</strong>, they still might be out there and just haven't been excavated and discovered yet.</p>
<p>This argument is an appeal to ignorance, because you don't know something/haven't seen any evidence of something, but you're using it to support your argument (that the society doesn't have a written language) all the same. </p>
<h2 id="heading-the-appeal-to-popular-opinion-fallacy-aka-bandwagon-fallacy-or-ad-populum-fallacy-definition-and-example">The Appeal to Popular Opinion Fallacy (AKA Bandwagon Fallacy or Ad Populum Fallacy) – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/bandwagon.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Have you ever heard the expression "jumping on the bandwagon"? It refers to someone changing their opinion or developing an opinion just because a bunch of people hold that same opinion.</p>
<p>There's not necessarily good evidence for that opinion, but people hold it anyway – maybe because it's been believed for a long time, or just because of the sheer number of people who believe it. But even though many people believe this thing, it may be factually incorrect or misleading.</p>
<p>This is a form of the appeal to popular opinion fallacy. You argue that something is true, good, or right just because a large number of people (or some popular or influential person or people) are doing it or believe it.</p>
<p>What's wrong with that? If everybody's doing it, it must be good – right? Well, not necessarily. People aren't always completely rational and don't always think things through. Think of the term "mob mentality". What does that conjure up? Probably a bunch of people causing chaos – in other words, not a good thing.</p>
<p>So before you say something like "Well everyone believes this, so it must be true", think again. Because this isn't a case of "strength in numbers" – an ad populum fallacy results from a lot of people believing incorrect or misleading information.</p>
<h3 id="heading-example-of-an-appeal-to-popular-opinion-fallacy">Example of an Appeal to Popular Opinion Fallacy</h3>
<p>What if your young teenager comes to you and wants to get a tattoo. They argue that all their high school friends are doing it because some celebrity just got this new tattoo.</p>
<p>Now, whatever your feelings about tattoos, this is a logical fallacy. Just because everyone's getting this tattoo doesn't mean it's the right choice for your kid. Maybe they haven't thought it through, or maybe they can't handle serious pain/needles, or maybe they will change their mind in a few years and regret such a permanent choice.</p>
<p>Also, everyone has different reasons for getting tattoos. Some do it to commemorate someone or something, some do it for the beauty of the art, some do it while intoxicated on vacation, and so on. But if a group of young teenagers is getting a tattoo on a whim to copy a celebrity, perhaps that's something you want your kid to think about more carefully.</p>
<p>So your kid arguing that "all my friends are doing it, so it's cool" doesn't take that into account. They'd need to think about getting a tattoo for their own reasons, and justify it to you that way.</p>
<p>Here's another example: you're FaceTiming with your family, and it's an election year. Most of your family belongs to one political party, but you belong to another. </p>
<p>Your mom starts trying to convince you to vote like they do – "The whole family votes this way! And we've been voting this way forever! Come on, you should be like your family and support the same candidate/things we do."</p>
<p>While it's understandable that your mom would want your political beliefs to align with hers, she's making a fallacious argument here. Just because they've always voted that way doesn't make it right.</p>
<p>She shouldn't say you should vote like she does because "that's what the family's always done/it's what they all do now". She should point out the benefits of her candidate, how they could help you out, why their policies are fair, and so on – and then let you decide for yourself.</p>
<h2 id="heading-the-hasty-generalization-fallacy-definition-and-example">The Hasty Generalization Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/grilling.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>People make generalizations all the time (that, right there, was a generalization!). And sometimes this is ok. If you're just stating something that's generally true, like "I like to cook" or "Puppies are cute", there's typically no harm in that. </p>
<p>The problem arises, though, when someone uses a generalization a bit too zealously in an argument without sufficient evidence. These types of "hasty" generalizations can fall into stereotyping, racism, falsehood, exaggeration, and more. </p>
<p>Often someone makes such a generalization when they're basing their opinion or argument off of the behavior or characteristics of just a few members of a group. This often means they're not taking the behavior of the whole group into consideration.</p>
<p>So why are these generalizations bad? Aside from lacking evidence and being based on problematic premises, people often assert hasty generalizations as if they were 100% true all the time. Which, of course, very few likely are.</p>
<p>If you want to avoid making hasty generalizations, you can use certain qualifiers when you make a generalization – like "Sometimes", "Often", "We often see", or "It may be the case that...". Those types of words and phrases let your listener know that you're not arguing that this thing is true across the board for everyone. It's just a general trend you've noticed.</p>
<h3 id="heading-example-of-a-hasty-generalization-fallacy">Example of a Hasty Generalization Fallacy</h3>
<p>Hasty generalizations are quite common, as people use generalizations all the time in regular conversation. And again, many generalizations don't hurt anyone. But let's look at some examples of bad generalizations.</p>
<p>If you say "People in the southern part of the US are so conservative and close-minded. I really can't stand how all they care about is football and BBQ", you're using a hasty generalization (a couple, actually). </p>
<p>While it's true that some people in the south have these characteristics, it's not true for everyone living in that region. And by making those assertions, you're perpetuating stereotypes that are likely overblown and miss a lot of nuance about southern American's characters and beliefs.</p>
<p>Here's another example: let's say you're having a fight with your significant other and you say, "You always pick fights with me!", you're likely exaggerating and making a hasty generalization. Unless it's literally true that they are always the one to start the fight, you're probably getting carried away in the heat of the moment.</p>
<p>One way to save yourself from making a hasty generalization in this case would be to say something like "You pick fights with me a lot" or "You often pick fights with me."</p>
<h2 id="heading-the-tu-quoque-fallacy-aka-appeal-to-hypocrisy-fallacy-definition-and-example">The Tu Quoque Fallacy (AKA Appeal to Hypocrisy Fallacy) – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/tu-quoque.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>Tu quoque in Latin means "You, too". And when you attempt to distract from your own guilt by calling out someone else's similar guilt, you're committing this fallacy.</p>
<p>The name makes sense – it's like you're saying "Well I may have done this, but you did it, too!" Now, think about that. Just because someone else did something similar to (or the same as) what you did, it doesn't make you any less guilty. You've still committed whatever crime or done whatever bad thing you've done.</p>
<p>This is also called an "appeal to hypocrisy" fallacy, because the person making the argument (let's call them Person A) often calls out the fact that someone else (Person B) did something similar to what they did. Person A argues that they may have messed up, but Person B did the same thing so should be punished. Person A is being a hypocrite because they're trying to escape the blame they'd like to assign to Person B.</p>
<p>It's tempting to use this type of argument, because people are always looking to shift the blame from themselves to others. It's especially enticing when that other person is not blameless and therefore seems to deserve some share of the guilt.</p>
<p>But this isn't an effective argument strategy because, while distracting, a tu quoque argument doesn't actually prove you innocent. It just draws attention (falsely) away from the issue at hand, which is your misdeed.</p>
<p>One thing to remember about tu quoque fallacies is that the information the person making the argument cites is typically irrelevant to the case at hand. Just because Person B is guilty also, doesn't mean Person A is any less guilty. So that accusation that Person A makes is irrelevant to their case.</p>
<h3 id="heading-example-of-a-tu-quoque-fallacy">Example of a Tu Quoque Fallacy</h3>
<p>Let's go back to our teenager. Perhaps they've been caught skipping school, and their parents want to ground them for a week. The teenager might argue, "Yeah I skipped third and fourth periods, but Marta did, too!"</p>
<p>While it's not great that Marta skipped class as well, it doesn't really make that teen any less guilty of skipping school. They just knew someone who did the same thing, and are trying to justify what they did by bringing up Marta's transgression as well. But it doesn't mean that they skipped any less school.</p>
<p>Here's another example: perhaps your friend caught you cheating on a test, and threatened to turn you into the teacher. But you saw them cheat in another class last year, so you say "I may have cheated today, but you cheated on that math test last year, too!"</p>
<p>Again, their cheating a year ago doesn't make you any less guilty right now. While it might feel good to say, "You did that, too, so how could you think I should be punished for it!", it's not really a strong or relevant argument to make.</p>
<p>Instead of resorting to this type of argument, make sure you take responsibility for your actions and keep your points relevant to the issue at hand. Don't think you can get away with something just by calling out someone else's hypocrisy. It's likely not going to help your case.</p>
<h2 id="heading-the-loaded-question-fallacy-example-and-definition">The Loaded Question Fallacy – Example and Definition</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/loaded-question.jpg" alt="Image" width="600" height="400" loading="lazy"></p>
<p>When you ask a question that intends to reinforce your position and undermine someone else's, you could be asking a loaded question. These questions are helpful to you but harmful to the person you're asking, and may skew the opinion of anyone listening in your favor, perhaps unfairly.</p>
<p>Instead of asking a straightforward question that attempts to get more or new information, a loaded question often includes an accusation (or a confirmation of an accusation) – an oft-quoted example is "Are you still beating your wife?"</p>
<p>In this question, you're referencing an accusation – that the person beat their wife – without directly accusing them of doing it currently. But by including it in the question, you're turning listeners' minds to the fact that this person did, at one point, beat their wife. So either way, they'll appear guilty.</p>
<h3 id="heading-example-of-a-loaded-question-fallacy">Example of a Loaded Question Fallacy</h3>
<p>Let's look at some more examples of loaded questions, and why they're fallacies.</p>
<p>Perhaps you're at a rally in support of clean energy, and a rep from Exxon is there. If you're not old enough to remember, <a target="_blank" href="https://en.wikipedia.org/wiki/Exxon_Valdez_oil_spill">Exxon had a horrific oil spill</a> in Alaska in 1989 that devastated 1300 miles of coastline and released over 10 million gallons of oil into the ocean.</p>
<p>You might call out that rep and loudly ask them if their company is still polluting the world's pristine oceans and killing millions of sea creatures. </p>
<p>Whatever your feelings about Exxon or environmental justice, it's not fair to set the company up like that for those listening. Your question is heavily loaded, and doesn't give them a shot at convincing others of their current position, whatever it might be. You're making your argument by essentially biasing the crowd against them from the start.</p>
<p>Here's another example: what if a company hires formerly incarcerated people, and you find out that one of them was a bank robber. If you asked their employer "You're really gonna let a thief handle your products?" you're creating a negative bias against them. </p>
<p>It's not necessary to refer to them as a thief or allude to their past as a bank robber. By doing so, you're only creating prejudicial feelings against them that may not be relevant or meaningful at this point in time.</p>
<p>So just remember – when you're asking questions to try to prove your point, keep them relevant, unbiased, and focused on the issue at hand.</p>
<h2 id="heading-the-red-herring-fallacy-definition-and-example">The Red Herring Fallacy – Definition and Example</h2>
<p><img src="https://www.freecodecamp.org/news/content/images/2021/05/Redherring.gif" alt="Image" width="600" height="400" loading="lazy"></p>
<p>You might wonder where the term "red herring" comes from. It's a bit of an odd name for a fallacy, don't you think?</p>
<p>Well, there has been some <a target="_blank" href="https://en.wikipedia.org/wiki/Red_herring">debate about this in the past</a> but most sources agree that a red herring signifies a distraction or something meant to mislead someone. </p>
<p>Fun fact before we continue: there's not actually a species of herring called a red herring. A "red herring" refers to a herring that's been brined and smoked until it becomes extremely pungent and turns a bright red color.</p>
<p>So these red herrings were used as training aids for animals because of their strong smell (to attempt to lead them in a certain direction).</p>
<p>Anyway, back to our fallacy: if you make an argument with the intention of distracting from the real issue at hand, it might be a red herring. Also, if you drop some seemingly related bit of info into a conversation or debate that leads your listener down the wrong path, that's also a red herring.</p>
<p>Ultimately, a red herring argument distracts or leads your listener away from the crux of the issue so that they get off course or off topic.</p>
<h3 id="heading-example-of-a-red-herring-fallacy">Example of a Red Herring Fallacy</h3>
<p>Remember, a red herring basically a diversionary tactic in an argument. It's meant to lead the listener away from the main point of the conversation.</p>
<p>Suppose you're arguing with someone who is in favor of a dam that's being constructed in a beautiful river. You bring up the environmental impact that said dam will have, and how devastating it'll be to the surrounding natural habitat.</p>
<p>Your opponent might say something like "Yes it will destroy the habitat for many fish and other river animals, but if we don't build the dam it'll take jobs away from so many people who would've worked on it."</p>
<p>Now, this person has just used a red herring fallacy to try to distract from the environmental impact of such a dam. Instead of arguing for the benefits of the dam itself, and arguing against the environmental impact, they're dropping in a red herring – the potential impact on the workers who would've been hired to build the dam.</p>
<p>While that itself is a whole separate issue, it doesn't deal with or respond to the issue at hand, which is what happens to the natural environment when the dam goes in.</p>
<h2 id="heading-how-to-avoid-logical-fallacies-in-your-arguments">How to Avoid Logical Fallacies in Your Arguments</h2>
<p>We've just discussed a whole bunch of logical fallacies, and you might be thinking – how can I make any arguments at all without saying something fallacious?</p>
<p>It's not always easy, as some of these fallacies are very tempting and easy to fall into. But as long as you stick to the point, don't try to deceive your listener, cite relevant evidence from relevant sources, and avoid any derogatory or misleading language, you should be ok.</p>
<p>Good luck, and happy debating!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Inductive VS Deductive Reasoning – The Meaning of Induction and Deduction, with Argument Examples ]]>
                </title>
                <description>
                    <![CDATA[ If you're conducting research on a topic, you'll use various strategies and methods to gather information and come to a conclusion. Two of those methods are inductive and deductive reasoning. So what's the difference between inductive and deductive r... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/inductive-vs-deductive-reasoning/</link>
                <guid isPermaLink="false">66b1fa5201079c4f2679de8c</guid>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ research ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ Abigail Rennemeyer ]]>
                </dc:creator>
                <pubDate>Sun, 29 Nov 2020 19:05:00 +0000</pubDate>
                <media:content url="https://cdn-media-2.freecodecamp.org/w1280/5f9c9632740569d1a4ca1062.jpg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>If you're conducting research on a topic, you'll use various strategies and methods to gather information and come to a conclusion.</p>
<p>Two of those methods are <strong>inductive</strong> and <strong>deductive</strong> reasoning.</p>
<p>So what's the difference between inductive and deductive reasoning, when should you use each method, and is one better than the other?</p>
<p>We'll answer those questions and give you some examples of both types of reasoning in this article.</p>
<h2 id="heading-what-is-inductive-reasoning">What is Inductive Reasoning?</h2>
<h3 id="heading-the-method-behind-inductive-reasoning">The method behind inductive reasoning</h3>
<p>When you're using inductive reasoning to conduct research, you're basing your conclusions off your observations. You gather information - from talking to people, reading old newspapers, observing people, animals, or objects in their natural habitat, and so on.</p>
<p>Inductive reasoning helps you take these observations and form them into a theory. So you're starting with some more specific information (what you've seen/heard) and you're using it to form a more general theory about the way things are.</p>
<h3 id="heading-what-does-the-inductive-reasoning-process-look-like">What does the inductive reasoning process look like?</h3>
<p>You can think of this process as a reverse funnel – starting with more specifics and getting broader as you reach your conclusions (theory).</p>
<p>Some people like to think of it as a "bottom up" approach (meaning you're starting at the bottom with the info and are going up to the top where the theory forms).</p>
<h3 id="heading-heres-an-example-of-an-inductive-argument">Here's an example of an inductive argument:</h3>
<p>Observation (premise): My Welsh Corgis were incredibly stubborn and independent (specific observation of behavior).<br>Observation (premise): My neighbor's Corgis are the same way (another specific observation of behavior).<br>Theory: All Welsh Corgis are incredibly stubborn and independent (general statement about the behavior of Corgis).</p>
<p>As you can see, I'm basing my theory on my observations of the behavior of a number of Corgis. Since I only have a small amount of data, my conclusion or theory will be quite weak.</p>
<p>If I was able to observe the behavior of 1000 Corgis (omg that would be amazing), my conclusion would be stronger – but still not certain. Because what if 10 of them were extremely well-behaved and obedient? Or what if the 1001st Corgi was?</p>
<p>So, as you can see, I can make a general statement about Corgis being stubborn, but I can't say that ALL of them are.</p>
<h3 id="heading-what-can-you-conclude-with-inductive-reasoning">What can you conclude with inductive reasoning?</h3>
<p>As I just discussed, one of the main things to know about inductive reasoning is that any conclusions you make from inductive research will not be 100% certain or confirmed.</p>
<p>Let's talk about the language we use to describe inductive arguments and conclusions. You can have a <strong>strong</strong> argument (if your premise(s) are true, meaning your conclusion is probably true). And that argument becomes <strong>cogent</strong> if the conclusion ends up being true. </p>
<p>Still, even if the premises of your argument are true, and that means that your conclusion is probably true, or likely true, or true much of the time – it's not certain.</p>
<p>And – weirdly enough – your conclusion can still be false even if all your premises are true (my Corgis were stubborn, my neighbor's corgis were stubborn, perhaps a friend's Corgis and the Queen of England's Corgis were stubborn...but that doesn't guarantee that all Corgis are stubborn).</p>
<h3 id="heading-how-to-make-your-inductive-arguments-stronger">How to make your inductive arguments stronger</h3>
<p>If you want to make sure your inductive arguments are as strong as possible, there are a couple things you can do.</p>
<p>First of all, make sure you have a large data set to work with. The larger your sample size, the stronger (and more certain/conclusive) your results will be. Again, thousands of Corgis are better than four (I mean, always, amiright?).</p>
<p>Second, make sure you're taking a random and representative sample of the population you're studying. So, for example, don't just study Corgi puppies (cute as they may be). Or show Corgis (theoretically they're better trained). You'd want to make sure you looked at Corgis from all walks of life and of all ages.</p>
<p>If you want to dig deeper into inductive reasoning, look into the three different types – generalization, analogy, and causal inference. You can also look into the two main methods of inductive reasoning, enumerative and eliminative. But those things are a bit out of the scope of this beginner's guide. :)</p>
<h2 id="heading-what-is-deductive-reasoning">What is Deductive Reasoning?</h2>
<h3 id="heading-the-method-behind-deductive-reasoning">The method behind deductive reasoning</h3>
<p>In order to use deductive reasoning, you have to have a theory to begin with. So inductive reasoning usually comes before deductive in your research process.</p>
<p>Once you have a theory, you'll want to test it to see if it's valid and your conclusions are sound. You do this by performing experiments and testing your theory, narrowing down your ideas as the results come in. You perform these tests until only valid conclusions remain.</p>
<h3 id="heading-what-does-the-deductive-reasoning-process-look-like">What does the deductive reasoning process look like?</h3>
<p>You can think of this as a proper funnel – you start with the broad open top end of the funnel and get more specific and narrower as you conduct your deductive research. </p>
<p>Some people like to think of this as a "top down" approach (meaning you're starting at the top with your theory, and are working your way down to the bottom/specifics). I think it helps to think of this as "<strong>reductive</strong>" reasoning – you're reducing your theories and hypotheses down into certain conclusions.</p>
<h3 id="heading-heres-an-example-of-a-deductive-argument">Here's an example of a deductive argument:</h3>
<p>We'll use a classic example of deductive reasoning here – because I used to study Greek Archaeology, history, and language:</p>
<p>Theory: All men are mortal<br>Premise: Socrates is a man<br>Conclusion: Therefore, Socrates is mortal</p>
<p>As you can see here, we start off with a general theory – that all men are mortal. (This is assuming you don't believe in elves, fairies, and other beings...) </p>
<p>Then we make an observation (develop a premise) about a particular example of our data set (Socrates). That is, we say that he is a man, which we can establish as a fact. </p>
<p>Finally, because Socrates is a man, and based on our theory, we conclude that Socrates is therefore mortal (since all men are mortal, and he's a man).</p>
<p>You'll notice that deductive reasoning relies less on information that could be biased or uncertain. It uses facts to prove the theory you're trying to prove. If any of your facts lead to false premises, then the conclusion is invalid. And you start the process over.</p>
<h3 id="heading-what-can-you-conclude-with-deductive-reasoning">What can you conclude with deductive reasoning?</h3>
<p>Deductive reasoning gives you a certain and conclusive answer to your original question or theory. A deductive argument is only <strong>valid</strong> if the premises are true. And the arguments are <strong>sound</strong> when the conclusion, following those valid arguments, is true.</p>
<p>To me, this sounds a bit more like the scientific method. You have a theory, test that theory, and then confirm it with conclusive/valid results.</p>
<p>To boil it all down, in deductive reasoning:</p>
<blockquote>
<p>"If all premises are true, the terms are <a target="_blank" href="https://en.wikipedia.org/wiki/Unambiguous">clear</a>, and the rules of deductive <a target="_blank" href="https://en.wikipedia.org/wiki/Logic">logic</a> are followed, then the conclusion reached is <a target="_blank" href="https://en.wikipedia.org/wiki/Logical_necessity">necessarily true</a>." (<a target="_blank" href="https://en.wikipedia.org/wiki/Deductive_reasoning">Source</a>)</p>
</blockquote>
<h2 id="heading-so-does-sherlock-holmes-use-inductive-or-deductive-reasoning">So Does Sherlock Holmes Use Inductive or Deductive Reasoning?</h2>
<p>Sherlock Holmes is famous for using his deductive reasoning to solve crimes. But really, he mostly uses inductive reasoning. Now that we've gone through what inductive and deductive reasoning are, we can see why this is the case.</p>
<p>Let's say Sherlock Holmes is called in to work a case where a woman was found dead in her bed, under the covers, and appeared to be sleeping peacefully. There are no footprints in the carpet, no obvious forced entry, and no immediately apparent signs of struggle, injury, and so on.</p>
<p>Sherlock observes all this as he looks in, and then enters the room. He walks around the crime scene making observations and taking notes. He might talk to anyone who lives with her, her neighbors, or others who might have information that could help him out.</p>
<p>Then, once he has all the info he needs, he'll come to a conclusion about how the woman died.</p>
<p>That pretty clearly sounds like an inductive reasoning process to me.</p>
<p>Now you might say - what if Sherlock found the "smoking gun" so to speak? Perhaps this makes his arguments and process seem more deductive. </p>
<p>But still, remember how he gets to his conclusions: starting with observations and evidence, processing that evidence to come up with a hypothesis, and then forming a theory (however strong/true-seeming) about what happened.</p>
<h2 id="heading-how-to-use-inductive-and-deductive-reasoning-together">How to Use Inductive and Deductive Reasoning Together</h2>
<p>As you might be able to tell, researchers rarely just use one of these methods in isolation. So it's not that deductive reasoning is better than inductive reasoning, or vice versa – they work best when used in tandem.</p>
<p>Often times, research will begin inductively. The researcher will make their observations, take notes, and come up with a theory that they want to test.</p>
<p>Then, they'll come up with ways to definitively test that theory. They'll perform their tests, sort through the results, and deductively come to a sure conclusion.</p>
<p>So if you ever hear someone say "I deduce that x happened", they better make sure they're working from facts and not just observations. :)</p>
<h2 id="heading-tldr-inductive-vs-deductive-reasoning-what-are-the-main-differences">TL;DR: Inductive vs Deductive Reasoning – What are the Main Differences?</h2>
<h3 id="heading-inductive-reasoning">Inductive reasoning:</h3>
<ul>
<li>Based on observations, conversations, stuff you've read</li>
<li>Starts with information/evidence and works towards a broader theory</li>
<li>Arguments can be strong and cogent, but never valid or sound (that is, certain)</li>
<li>Premises can all be true, but conclusion doesn't have to be true</li>
</ul>
<h3 id="heading-deductive-reasoning">Deductive reasoning:</h3>
<ul>
<li>Based on testing a theory, narrowing down the results, and ending with a conclusion</li>
<li>Starts with a broader theory and works towards certain conclusion</li>
<li>Arguments can be valid/invalid or sound/unsound, because they're based on facts</li>
<li>If premises are true, conclusion has to be true</li>
</ul>
<p>And here's a cool and helpful chart if you're a visual learner: </p>
<p><img src="https://www.freecodecamp.org/news/content/images/2020/12/Argument_terminology_used_in_logic_-en-.svg" alt="Image" width="600" height="400" loading="lazy">
<em>Image <a target="_blank" href="https://commons.wikimedia.org/w/index.php?curid=88640183">source</a></em></p>
<h2 id="heading-thats-about-it">That's about it!</h2>
<p>Now, if you need to conduct some research, you should have a better idea of where to start – and where to go from there.</p>
<p>Just remember that induction is all about observing, hypothesizing, and forming a theory. Deducing is all about taking that (or any) theory, boiling it down, and testing until a certain conclusion(s) is all that remains.</p>
<p>Happy reasoning!</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Optimizing Inefficiency: Human folly and the quest for the worst sorting algorithm ]]>
                </title>
                <description>
                    <![CDATA[ By Daniel Miller Lookup Bogosort, Slowsort, or Stooge sort on Wikipedia sometime and prepare to enter a deep rabbit hole which leads to the strange world of “perversely awful” sorting algorithms. These three relatively tame algorithms, used primarily... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/optimizing-inefficiency-human-folly-and-the-quest-for-the-worst-sorting-algorithm-c0ba7b32ffd/</link>
                <guid isPermaLink="false">66c35c52cf1314a450f0d739</guid>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ software development ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Software Engineering ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 03 Apr 2019 21:25:41 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*IoLrln5Pj3oNhOkBWFPmNA.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Daniel Miller</p>
<p>Lookup <a target="_blank" href="https://en.wikipedia.org/wiki/Bogosort">Bogosort</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/Slowsort">Slowsort</a>, or <a target="_blank" href="https://en.wikipedia.org/wiki/Stooge_sort">Stooge sort</a> on Wikipedia sometime and prepare to enter a deep rabbit hole which leads to the strange world of “<a target="_blank" href="http://www.hermann-gruber.com/pdf/fun07-final.pdf">perversely awful</a>” sorting algorithms.</p>
<p>These three relatively tame algorithms, used primarily for illustrative purposes in computer science classes, are only the beginning. A strange…</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ I know nothing, but it is okay ]]>
                </title>
                <description>
                    <![CDATA[ By Nastasia Saby One thing I like the most about being a developer is learning. But to learn something, you must admit that you do not know it. And sometimes it can be difficult. Some time ago, I was asked to deal with a linear regression. I was pani... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/i-know-nothing-but-it-is-okay-6c0d9a4fe09f/</link>
                <guid isPermaLink="false">66c3575f0cede4e9b1329c88</guid>
                
                    <category>
                        <![CDATA[ Developer ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Imposter syndrome ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Tue, 08 Jan 2019 21:28:26 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*KLK_Z5BotnHdlaNVfZII1w.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Nastasia Saby</p>
<p>One thing I like the most about being a developer is learning. But to learn something, you must admit that you do not know it.</p>
<p>And sometimes it can be difficult.</p>
<p>Some time ago, I was asked to deal with a linear regression. I was panicked. I had no real idea of what it was about except that it was mathematics. The problem is that I was convinced I should have known that.</p>
<p>I was blaming myself: “But why do you have a baccalaureate (high school degree) in literature instead of a normal baccalaureate like everyone else in your profession would? And why have you preferred studying literature rather than computer science at university? If you had chosen normal studies, you would have known what is a linear regression. You would have known how to deal with that. You have no right to be here. You are an impostor”.</p>
<p>Then I did what I do when I am panicked: I called my sister. She has a “normal” baccalaureate.</p>
<p>“Hi little sister, can you explain me what is a linear regression please?”</p>
<p>She answered me that she had no idea what it was and that she never learned that in high school.</p>
<p>I was relieved. I still did not know what a linear regression was, but I could confess without shame my ignorance. I took some time to understand it and finally dealt with it.</p>
<p>You could say that this story ends well. I am not so sure because I should have confessed my ignorance before calling my sister.</p>
<p>Sometimes, I have the impression that I am not in my place. I feel I am stealing the job of someone else, someone with “normal” studies. Consequently, I am afraid of being exposed.</p>
<p>I know that I am not the only one to get this feeling of being an impostor. There are many reasons you can find yourself in this situation.</p>
<p>I was recently working with a brilliant person with many capabilities. But she was sure of being an impostor because she did not know this framework or this thing in Java, leading her into trouble at work.</p>
<p>If we step back, there is no shame if you do not know something. The most important thing is to admit it.</p>
<p>First, it is impossible to know everything.</p>
<p>Then, if you have not learned something, it is probably because you were doing something else instead. If I did not know until now how Kafka was really dealing with messages from producers, it is because I spent several months learning stuff about Spark. This stuff helped me to pass a certification. That is not so bad in the end.</p>
<p>It was also because I finally recognized that I knew so few things about functional programming with Scala that I decided to follow online courses. Again, that is not so bad.</p>
<p>Saying that you do not know is a way towards progress.</p>
<p>I cannot help thinking about Socrates and this fabulous sentence:</p>
<blockquote>
<p>The only thing I know is that I know nothing.</p>
</blockquote>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Z8Vk1nHhGtdDrLWe41P2RUk3JPgmU8AFf9sn" alt="Image" width="290" height="364" loading="lazy">
<em>A philosopher — drawing from me</em></p>
<p>One of the greatest philosophers (for me, as for many) presented himself as ignorant. I believe recognizing yourself as ignorant is a strong way towards self progression and raising the bar.</p>
<p>When you recognize what you do not know, you do not have prejudices. You can learn peacefully. You are not narrow-minded. You are ready to learn everything.</p>
<p>Therefore, I am happy to have learned the concept of linear regression even if at the beginning I was totally lost.</p>
<p>I should have said the truth peacefully and directly: “I know nothing about linear regressions but it is okay. I will learn it”.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/uuKIctwvzHW4mOQ7XZ1T5PwWO2Mo2ewJCko0" alt="Image" width="800" height="533" loading="lazy">
<em>Peaceful landscape — picture from Vincent Sebille</em></p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Will the sun rise tomorrow? ]]>
                </title>
                <description>
                    <![CDATA[ By Peter Gleeson Laplace, Bayes, and machine learning today It may not be a question that you were worrying much about. After all, it appears to happen every day without fail. But what is the probability the sun will rise tomorrow? Believe it or not,... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/will-the-sun-rise-tomorrow-255afc810682/</link>
                <guid isPermaLink="false">66d460c047a8245f78752aa9</guid>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Machine Learning ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Science  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 15 Aug 2018 19:39:06 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*WxMNTDnwTA-9R_7K" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Peter Gleeson</p>
<h4 id="heading-laplace-bayes-and-machine-learning-today">Laplace, Bayes, and machine learning today</h4>
<p>It may not be a question that you were worrying much about. After all, it appears to happen every day without fail.</p>
<p>But what <em>is</em> the probability the sun will rise tomorrow?</p>
<p>Believe it or not, this question was given consideration by one of mathematics’ all-time greats <a target="_blank" href="http://scienceworld.wolfram.com/biography/Laplace.html">Pierre-Simon Laplace</a> in his pioneering work of 1814, <em>“</em><a target="_blank" href="https://ia801407.us.archive.org/35/items/essaiphilosophiq00lapluoft/essaiphilosophiq00lapluoft_bw.pdf">Essai philosophique sur les probabilités</a>”.</p>
<p>Fundamentally, Laplace’s treatment of the question was intended to illustrate a more general concept. It was not a serious attempt to estimate whether the sun will, in fact, rise.</p>
<p>In his essay, Laplace describes a framework for probabilistic reasoning that today we recognise as Bayesian.</p>
<p>The Bayesian approach forms a keystone in many modern machine learning algorithms. But the computational power required to make use of these methods has only been available since the latter half of the 20th Century.</p>
<p>(So far, it appears current state-of-the-art AI is keeping quiet on the issue of tomorrow’s sunrise.)</p>
<p>Laplace’s ideas are still relevant today, despite being developed more than two centuries ago. This article will review some of these ideas, and show how they are used in modern applications, perhaps envisaged by Laplace’s contemporaries.</p>
<h4 id="heading-pierre-simon-laplace">Pierre-Simon Laplace</h4>
<p>Born in the small Normandy commune of Beaumont-en-Auge in 1749, Pierre-Simon Laplace was initially marked out to become a theologian.</p>
<p>However, while studying at the University of Caen, he discovered a brilliant aptitude for mathematics. He transferred to Paris, where he impressed the great mathematician and physicist Jean le Rond d’Alembert.</p>
<p>At the age of 24, Laplace was elected to the prestigious Académie des Sciences.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/wz95dMqv5qEq65D9G1Xg3-DQ26SGSfFmGWyF" alt="Image" width="200" height="272" loading="lazy"></p>
<p>Laplace was an astonishingly prolific scientist and mathematician. Amongst his many contributions, his work on probability, planetary motion, and mathematical physics stand out. He counted figures such as Antoine Lavoisier, Jean d’Alembert, Siméon Poisson, and even Napoleon Bonaparte, as his collaborators, advisers, and students.</p>
<p>Laplace’s “Essai philosophique sur les probabilités” was based upon a lecture he delivered in 1795. It provided a general overview of ideas contained within his work “Théorie analytique des probabilités”, published two years earlier in 1812.</p>
<p>In “Essai philosophique”, Laplace provides ten principles of probability. The first few cover basic definitions, and how to calculate probabilities relating to independent and dependent events.</p>
<p>Principles eight, nine, and ten concern the application of probability to what we might describe today as cost-benefit analysis.</p>
<p>The sixth is an important generalization of <a target="_blank" href="http://mathworld.wolfram.com/BayesTheorem.html">Thomas Bayes’ eponymous theorem of 1763</a>.</p>
<p>It states that, for a given event, the likelihood of each possible cause is found by multiplying the prior probability of that cause by a fraction.</p>
<p>This fraction is the probability of the event arising from that particular cause, divided by the probability of the event occurring by any cause.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/iSkx6zOPJr9jeMHRKxCgwKQ4b3nsRVxgI8Ln" alt="Image" width="800" height="145" loading="lazy">
<em>Probability of A-given-B equals probability of A times probability of B-given-A, divided by probability of B</em></p>
<p>This theorem’s influence within machine learning cannot be overstated.</p>
<p>The seventh principle is the one that has caused the most controversy since its publication. However, the actual wording is innocuous enough.</p>
<p>Rather, it is Laplace’s choice of discussing the probability of the sun rising the next day by way of illustrative example that has in turn drawn derision and objection over the following two centuries.</p>
<p>The rule of succession is still used today under various guises, and sometimes in the form Laplace originally described.</p>
<p>In fact, the rule of succession represents an important early step in applying Bayesian thinking to systems for which we have very limited data and little or no prior knowledge. This is a starting point often faced in modern machine learning problems.</p>
<h4 id="heading-laplaces-rule-of-succession">Laplace’s rule of succession</h4>
<p>The seventh principle of probability given in Laplace’s “Essai philosophique” is, in essence, straightforward.</p>
<p>It states that the probability of a given event occurring is found by summing the probability of each of its potential causes multiplied by the probability of that cause giving rise to the event in question.</p>
<p>Laplace then proceeds to outline an example based upon drawing balls from urns. So far, so good. Nothing contentious yet.</p>
<p>However, he then describes how to proceed with estimating the probability of an event occurring in situations where we have limited (or indeed no) prior knowledge about what that probability might be.</p>
<blockquote>
<p>“On trouve ainsi qu’un événement étant arrivé de suite un nombre quelconque de fois , la probabilité qu’il arrivera encore la fois suivante est égale à ce nombre augmenté de l’unité, divisé par le même nombre augmenté de deux unités.”</p>
</blockquote>
<p>Which translates in English: “So, one finds for a event which has occurred any number of times until now, the probability it will occur again the next time is equal to this number increased by one, divided by the same number increased by two”.</p>
<p>Or, in math notation:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/oTRD9vv5j3fG3Tt-e2mFkbzNTEKxzBS9aH-i" alt="Image" width="800" height="79" loading="lazy"></p>
<p>That is, given <em>s</em> successes out of <em>n</em> trials, the probability of success on the next trial is approximately (s+1)/(n+2).</p>
<p>To make his point, Laplace doesn’t hold back:</p>
<blockquote>
<p>“… par exemple, remonter la plus ancienne époque de l’histoire à cinq mille ans, ou à 1,826,213 jours, et le soleil s’étant levé constamment dans cet intervalle, à chaque révolution de vingtquatre heures, il y a 1,826,214 à parier contre un qu’il se lèvera encore demain”</p>
</blockquote>
<p>Which translates as: “…for example, given the sun has risen every day for the last 5000 years — or 1,826,213 days — the probability it will rise tomorrow is 1,826,214 / 1,826,215”.</p>
<p>At 99.9%, that’s a pretty certain bet. And it only becomes more certain each day the sun continues to rise.</p>
<p>Yet Laplace acknowledges that, for someone who understands the mechanism by which the sun rises and sees no reason why it should cease to function, even this probability is unreasonably low.</p>
<p>And it turns out that this qualification is perhaps just as important as the actual rule itself. After all, it hints at the fact that our prior knowledge of a system is encoded in the assumptions we make when assigning probabilities to each of its potential outcomes.</p>
<p>This is true in machine learning today, especially when we try learning from limited or incomplete training data.</p>
<p>But what is the rationale behind Laplace’s rule of succession, and how does it live on in some of today’s most popular machine learning algorithms?</p>
<h4 id="heading-nothing-is-impossible">Nothing is impossible?</h4>
<p>To better understand the significance of Laplace’s rule, we need to consider what it means to have very little prior knowledge about a system.</p>
<p>Say you have one of Laplace’s urns, which you know to contain at least one red ball. You know nothing else about the contents of the urn “system”. Perhaps it contains many different colors, perhaps it only contains that one red ball.</p>
<p>Draw one ball from the urn. You know the probability that it will be red is greater than zero, and either less than or equal to one.</p>
<p>But, as you don’t know whether the urn contains other colors, you cannot say the probability of drawing red certainly equals one. You simply cannot rule out any other possibility.</p>
<p>So, how do you estimate the probability of drawing a red ball from the urn?</p>
<p>Well, according to Laplace’s rule of succession, you can model drawing a ball from the urn as a <a target="_blank" href="http://www.mathwords.com/b/bernoulli_trials.htm">Bernoulli trial</a> with two possible outcomes: “red” and “not-red”.</p>
<p>Before we’ve drawn anything from the urn, we’ve already allowed for two potential outcomes to exist. In so doing, we’ve effectively “pseudo-counted” two imaginary draws from the urn, observing each outcome once.</p>
<p>This gives each outcome (“red” and “not-red”) a probability of 1/2.</p>
<p>As the number of draws from the urn increases, the effect of these pseudo-counts becomes less and less important. If the first ball drawn is red, you update the probability of the next one being red to (1+1)/(1+2) = 2/3.</p>
<p>If the next ball is red, the probability updates to 3/4. If you keep drawing red, the probability reaches ever closer to 1.</p>
<p>In today’s language, probability concerns a <a target="_blank" href="http://mathworld.wolfram.com/SampleSpace.html">sample space</a>. This is a mathematical set of all possible outcomes for a given “experiment” (a process that selects one of the outcomes).</p>
<p>Probability was put on a formal axiomatic basis by Andrey Kolmogorov in the 1930s. <a target="_blank" href="https://www.le.ac.uk/users/dsgp1/COURSES/LEISTATS/Lecture2.pdf">Kolmogorov’s axioms</a> make it easy to prove that a sample space must contain at least one element.</p>
<p>Kolmogorov also defines <a target="_blank" href="https://en.wikipedia.org/wiki/Probability_measure">probability as a measure</a> that returns a real valued number between zero and one for all elements of the sample space.</p>
<p>Naturally, probability makes a useful way to model real world systems, especially when you assume complete knowledge about the contents of the sample space.</p>
<p>But when we don’t understand the system at hand, we don’t know the sample space — apart from that it must contain at least one element. This is a common starting point in many machine learning contexts. We have to learn the contents of the sample space as we go.</p>
<p>Therefore, we ought to allow the sample space to contain at least one extra, catch-all element — or, if you like, the “unknown unknown”. Laplace’s rule of succession tells us to assign the “unknown unknown” a probability of 1/n_+_2, after n repeated observations of known events.</p>
<p>Although in many cases it is convenient to ignore the possibility of unknown unknowns, there are <a target="_blank" href="https://en.wikipedia.org/wiki/Skepticism#Philosophical_skepticism">epistemological grounds</a> for always allowing such eventualities to exist.</p>
<p>One such argument is known as Cromwell’s Rule, coined by <a target="_blank" href="https://www.theguardian.com/science/2014/mar/16/dennis-lindley">the late Dennis Lindley</a>. Quoting the 17th century’s <a target="_blank" href="https://www.historic-uk.com/HistoryUK/HistoryofEngland/Oliver-Cromwell/">Oliver Cromwell</a>:</p>
<blockquote>
<p>“I beseech you, in the bowels of Christ, think it possible that you may be mistaken”</p>
</blockquote>
<p>This rather dramatic statement asks us to allow a remote possibility for the unexpected to occur. In the language of Bayesian probability, this amounts to requiring us to always consider a non-zero prior.</p>
<p>Because if your prior probability is set to zero, no amount of evidence will ever convince you otherwise. After all, even the strongest evidence to the contrary will still yield a posterior probability of zero, when multiplied by zero.</p>
<h4 id="heading-objections-and-a-defence-of-laplace">Objections, and a defence of Laplace</h4>
<p>It may come as little surprise to learn that Laplace’s sunrise example attracted much criticism from his contemporaries.</p>
<p>People objected to the perceived simplicity — naivety, even — of Laplace’s assumptions. The idea that there was a 1/1,826,215 probability the sun would not rise the following day seemed absurd.</p>
<p>It is tempting to believe that, given a large number of trials, a non-zero probability event must happen. And therefore, observing so many consecutive sunrises without a single failure surely implies Laplace’s estimate is an overestimate?</p>
<p>For example, you might expect that after a million trials, you’d have observed a one-in-a-million event — almost guaranteed by definition! What’s the probability of doing otherwise?</p>
<p>Well, you wouldn’t be astonished if you tossed a fair coin twice without landing heads. Nor would it be cause for concern if you rolled a die six times, and never saw the number six. These are events with probability 1/2 and 1/6 respectively, but that absolutely does not guarantee their occurrence in the first two and six trials.</p>
<p>A <a target="_blank" href="https://en.wikipedia.org/wiki/E_(mathematical_constant)#Bernoulli_trials">result attributed to Bernoulli</a> back in the 17th Century finds the limit as the probability 1/n and number of trials n grow very large:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/SxCrLe6DHd8yei8xYNvUjyCa69t9zcNgSGtV" alt="Image" width="800" height="73" loading="lazy"></p>
<p>Although on average you will have observed at least one occurrence of an event with probability 1/n after n trials, there is still a greater than 1/3 chance you will not.</p>
<p>Likewise, if the true probability of the sun failing to rise were indeed 1/1,826,215, then we perhaps shouldn’t be so surprised such an occurrence has never been recorded in history.</p>
<p>And, arguably, Laplace’s qualification is too generous.</p>
<p>It is true that, for a person who claims to understand the mechanism by which the sun rises every day, the probability of it failing to do so must be much closer to zero.</p>
<p>Yet to assume an understanding of such a mechanism requires us to possess prior knowledge of the system, beyond that which we have observed. This is because such a mechanism is implicitly assumed constant — in other words, true for all time.</p>
<p>This assumption lets us, in a sense, “conjure up” an unlimited number of observations — on top of those we have actually observed. It’s an assumption called for by none other than Isaac Newton, at the beginning of the third book in his famous “<a target="_blank" href="https://ia802706.us.archive.org/0/items/newtonspmathema00newtrich/newtonspmathema00newtrich.pdf">Philosophiae Naturalis Principia Mathematica</a>”.</p>
<p>Newton outlines four “Rules of Reasoning in Philosophy”. The fourth rule claims we can regard propositions derived from previous observations as “very nearly true”, until contradicted by future observations.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/6QtTrbJmXaemWI37d-vPeyEWG78rywIUdYVo" alt="Image" width="800" height="178" loading="lazy">
<em>“In experimental philosophy we are to look upon propositions collected by general induction from phenomena as accurately or very nearly true”</em></p>
<p>Such an assumption was crucial for the scientific revolution, despite being a kick in the teeth for philosophers such as David Hume, <a target="_blank" href="http://www.davidhume.org/texts/ehu.html">who famously argued for the problem of induction</a>.</p>
<p>It is this epistemological compromise that lets us do useful science and, in turn, invent technology. Somewhere along the line, as we see the estimated probability of the sun failing to rise diminish ever closer to zero, we allow ourselves to “round down” and claim a fully fledged scientific truth.</p>
<p>But all of this presumably lies beyond the scope of the point Laplace originally sought to make.</p>
<p>Indeed, his choice of a sunrise example is unfortunate. The rule of succession really comes into its own when applied to completely unknown “black-box” systems for which we have zero (or very few) observations.</p>
<p>This is because the rule of succession offers an early example of a non-informative prior.</p>
<h4 id="heading-how-to-assume-as-little-as-possible">How to assume as little as possible</h4>
<p>Bayesian probability is a keystone concept in modern machine learning. Algorithms such as <a target="_blank" href="http://scikit-learn.org/stable/modules/naive_bayes.html">Naive Bayes classification</a>, <a target="_blank" href="https://en.wikipedia.org/wiki/Expectation%E2%80%93maximization_algorithm">Expectation Maximisation</a>, <a target="_blank" href="http://www.orchid.ac.uk/eprints/40/1/fox_vbtut.pdf">Variational Inference</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo">Markov Chain Monte Carlo</a> are amongst the most popular in use today.</p>
<p>Bayesian probability generally refers to <a target="_blank" href="https://plato.stanford.edu/entries/probability-interpret/">an interpretation of probability</a> where you update your (often subjective) belief in the light of new evidence.</p>
<p>Two key concepts are prior and posterior probabilities.</p>
<p>Posterior probabilities are those we ascribe to after updating our beliefs in the face of new evidence.</p>
<p>Prior probabilities (or ‘priors’) are those we hold to be true before seeing new evidence.</p>
<p>Data scientists are interested in how we assign prior probabilities to events in the absence of any previous knowledge at all. This is a typical starting point for many problems in machine learning and predictive analytics.</p>
<p>Priors can be informative, in the sense they come with “opinions” about the probability of different events. These “opinions” can be strong or weak, and are usually based on past observations or otherwise reasonable assumptions. These are invaluable in situations where we want to train our machine learning model quickly.</p>
<p>However, priors can also be non-informative. This means they assume as little as possible about the respective probabilities of an event. These are useful in situations where we want our machine learning model to learn from a blank state.</p>
<p>So we must ask: how do you measure how “informative” a prior probability distribution is?</p>
<p><a target="_blank" href="http://web.mit.edu/6.933/www/Fall2001/Shannon2.pdf">Information theory</a> provides an answer. This is a branch of mathematics that concerns how information is measured and communicated.</p>
<p>Information can be thought of in terms of certainty, or a lack thereof.</p>
<p>After all, in an everyday sense, the more information you have about some event, the more certain you are about its outcome. Less information equates to less certainty. This means that information theory and probability theory are inextricably linked.</p>
<p><a target="_blank" href="http://mathworld.wolfram.com/Entropy.html">Information entropy</a> is a fundamental concept in information theory. It serves as a measure of the uncertainty inherent to a given <a target="_blank" href="http://mathworld.wolfram.com/DistributionFunction.html">probability distribution</a>. A probability distribution with high entropy is one for which the outcome is more uncertain.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/zKwL45eeeHVN5a5CNdJ863vwN-Xk7v-DH-Ag" alt="Image" width="800" height="107" loading="lazy"></p>
<p>Perhaps intuitively, you can reason that a uniform probability distribution — a distribution for which each event is equally likely — has the highest possible entropy. For example, if you flipped a fair coin and a biased coin, which outcome would you be least certain about?</p>
<p>Information entropy provides a formal means of quantifying this, and if you know some calculus, <a target="_blank" href="https://en.wikipedia.org/wiki/Lagrange_multiplier#Example_3:_Entropy">you can check out the proof here</a>.</p>
<p>So the uniform distribution is, in a very real sense, the least informative distribution possible. And for that reason, it makes an obvious choice for an uninformative prior.</p>
<p>Perhaps you’ve spotted how Laplace’s rule of succession effectively amounts to using a uniform prior? By adding one success and one failure before we’ve even observed any outcomes, we’re using a uniform probability distribution to represent our “prior” belief about the system.</p>
<p>Then, as we observe more and more outcomes, the weight of the evidence increasingly overpowers the prior.</p>
<h4 id="heading-case-study-naive-bayes-classification">Case study: Naive Bayes classification</h4>
<p>Today, Laplace’s rule of succession is generalised to additive smoothing and pseudo-counting.</p>
<p>These are techniques which allow us to use non-zero probabilities for events not observed in training data. This is an essential part of how machine learning algorithms are able to generalize when faced with inputs not seen previously.</p>
<p>For instance, take Naive Bayes classification.</p>
<p>This is a simple yet effective algorithm that can classify textual and other suitably tokenized data, using Bayes’ theorem.</p>
<p>The algorithm is trained on a corpus of pre-classified data, in which each document consists of a set of words or “features”. The algorithm begins by estimating the probability of each feature, given a certain class.</p>
<p>Using Bayes’ theorem (and some very naive assumptions about feature independence), the algorithm can then approximate the relative probabilities of each class, given the features observed in a previously unseen document.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/-6HX91wIpY2IY9ySy3tPJJq4k0q4bZGq50Mp" alt="Image" width="800" height="123" loading="lazy">
<em>The best estimate is the class, k, which maximizes the likelihood of observing the individual features, x, within a given document</em></p>
<p>An important step in Naive Bayes classification is estimating the probability of a feature being observed within a given class. This can be done by calculating the frequency at which the feature is observed in each of that class’s records in the training data.</p>
<p>For instance, the word “Python” might appear in 12% of all documents classed as “programming”, compared to 1% of all documents classed as “start-up”. The word “learn” might appear in 10% of programming documents and 20% of all start-up documents.</p>
<p>Take the sentence “learn Python”.</p>
<p>Using these frequencies, we find the probability of the sentence being classed as “programming” equals 0.12 ×0.10 = 0.012, and the probability of it being classed as “start-up” is 0.01×0.20 = 0.002.</p>
<p>Therefore, “programming” is the more likely of these two classes.</p>
<p>But this frequency-based approach runs into trouble whenever we consider a feature which never occurs in a given class. This would mean it has a frequency of zero.</p>
<p>Naive Bayes classification requires us to multiply probabilities, but multiplying anything by zero will, of course, always yield zero.</p>
<p>So, what happens if a previously unseen document does contain a word never observed in a given class in the training data? That class will be deemed impossible — no matter how frequently every other word in the document occurs in that class.</p>
<h4 id="heading-additive-smoothing">Additive smoothing</h4>
<p>An approach called additive smoothing offers a solution. Instead of allowing for zero frequencies, we add a small constant to the numerator. This prevents unseen class/feature combinations from derailing the classifier.</p>
<p>When this constant equals one, additive smoothing is the same as applying Laplace’s rule of succession.</p>
<p>As well as Naive Bayes classification, additive smoothing is used in other probabilistic machine learning contexts. Examples include problems in language modelling, neural networks, and hidden Markov models.</p>
<p>In mathematical terms, additive smoothing amounts to using a beta distribution as a <a target="_blank" href="https://en.wikipedia.org/wiki/Conjugate_prior">conjugate prior</a> for carrying out Bayesian inference with binomial and geometric distributions.</p>
<p>The beta distribution is a family of probability distributions defined over the interval [0,1]. It takes two shape parameters, α and β. Laplace’s rule of succession corresponds to setting α = 1 and β <em>=</em> 1.</p>
<p>As discussed above, the beta(1,1) distribution is the one for which information entropy is maximised. However, there are alternative priors for cases in which the assumption of one success and one failure are not valid.</p>
<p>For instance, Haldane’s prior is defined as a beta(0,0) distribution. It applies in cases when we are not even sure if we can allow for a binary outcome. Haldane’s prior places an infinite amount of “weight” on zero and one.</p>
<p>Jeffrey’s prior, the beta(0.5, 0.5) distribution, is another non-informative prior. It has the helpful property that it remains invariant under reparameterization. Its derivation is beyond the scope of this article, but if you are interested, <a target="_blank" href="https://math.stackexchange.com/questions/210607/in-what-sense-is-the-jeffreys-prior-invariant">check out this thread</a>.</p>
<h4 id="heading-the-legacy-of-ideas">The legacy of ideas</h4>
<p>Personally, I find it fascinating how some of the earliest ideas in probability and statistics have survived years of contention, and still find widespread use in modern machine learning.</p>
<p>It is extraordinary to realise that the influence of ideas developed more than two centuries ago is still being felt today. Machine learning and data science have gained real mainstream momentum in the last decade or so. But the foundations upon which they are built were laid long before the first computers were even close to realization.</p>
<p>It’s no coincidence that such ideas border on the philosophy of knowledge. This becomes especially relevant as machines become more and more intelligent. At what point might the focus shift onto our philosophy of consciousness?</p>
<p>Finally, what would Laplace and his contemporaries make of machine learning today? It’s tempting to suggest they’d be astounded by the progress that’s been made.</p>
<p>But that would probably be a disservice to their foresight. After all, the French philosopher <a target="_blank" href="https://plato.stanford.edu/entries/descartes/">René Descartes</a> had written of <a target="_blank" href="http://www.biusante.parisdescartes.fr/sfhm/hsm/HSMx1987x021x004/HSMx1987x021x004x0381.pdf">a mechanistic philosophy</a> back in the 17th Century. Describing a hypothetical machine:</p>
<blockquote>
<p>“Je désire que vous considériez … toutes les fonctions que j’ai attribuées à cette machine, comme … la réception de la lumière, des sons, des odeurs, des goûts … l’empreinte de ces idées dans la mémoire … et enfin les mouvements extérieurs … qu’ils imitent le plus parfaitement possible ceux d’un vrai homme … considériez que ces fonctions … de la seule disposition de ses organes, ni plus ni moins que font les mouvements d’une horloge … <strong>de celle de ses contrepoids et de ses roues”</strong></p>
</blockquote>
<p>Which translates as: “I desire that you consider that all the functions I’ve attributed to this machine such as… the reception of light, sound, smell and taste… the imprint of these ideas in the memory… and finally the external movements which imitate as perfectly as possible those of a true human…Consider that these functions are only under the control of the organs, no more or less than the movements of a clock are to its counterweights and wheels”</p>
<p>The passage above describes a hypothetical machine capable of responding to stimuli and behaving like a “true human”. It was published in Descartes’ 1664 work “Traité de l’homme” — a full 150 years before Laplace’s “Essai philosophique sur les probabilités”.</p>
<p>Indeed, the 18th and early 19th Centuries saw the construction of incredibly sophisticated automata by inventors such as <a target="_blank" href="https://en.wikipedia.org/wiki/Pierre_Jaquet-Droz">Pierre Jaquet-Droz</a> and <a target="_blank" href="https://en.wikipedia.org/wiki/Henri_Maillardet">Henri Maillardet</a>. These clockwork androids could be “programmed” to <a target="_blank" href="https://www.youtube.com/watch?v=bY_wfKVjuJM">write</a>, <a target="_blank" href="https://www.youtube.com/watch?v=LCNQvm61_78">draw</a>, and <a target="_blank" href="https://www.youtube.com/watch?v=9n0gCi-oQ9s">play music</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/oQoY4BGg2Yjpyzp3nASbEx5D9Jm3RyryTITm" alt="Image" width="800" height="438" loading="lazy">
_Drawing produced by one of Henri Maillardet’s early 19th Century automata ([video](https://www.youtube.com/watch?v=LCNQvm61_78" rel="noopener" target="<em>blank" title="))</em></p>
<p>So there is no doubting that Laplace and his contemporaries could conceive of the notion of an intelligent machine. And it surely would not have escaped their notice how progress made in the field of probability might be applied to machine intelligence.</p>
<p>Right at the beginning of “Essai philosophique”, Laplace writes of a hypothetical super-intelligence, retrospectively named “Laplace’s Demon”:</p>
<blockquote>
<p>“Une intelligence qui, pour un instant donné, connaîtrait toutes les forces dont la nature est animée, et la situation respective des êtres qui la composent, si d’ailleurs elle était assez vaste pour sou- mettre ces données à l’analyse … rien ne serait incertain pour elle, et l’avenir comme le passé, serait présent à ses yeux”</p>
</blockquote>
<p>Which translates as: “An intelligence, which in a given moment, knows all the forces by which nature is animated, and the respective situation of the beings which compose it, and if it were large enough to submit these data to analysis … nothing would be uncertain to it, and the future as the past, would be present in its eyes”.</p>
<p>Could Laplace’s Demon be realized as one of Descartes’ intelligent machines? <a target="_blank" href="https://ti.arc.nasa.gov/m/pub-archive/1476h/1476%20(Wolpert).pdf">Modern sensibilities overwhelmingly suggest no</a>.</p>
<p>Yet Laplace’s premise envisaged on a smaller scale may soon become a reality, thanks in no small part to his own pioneering work in the field of probability.</p>
<p>Meanwhile, the sun will (probably) continue to rise.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ The philosophy of programming ]]>
                </title>
                <description>
                    <![CDATA[ By Haoxian Chen Logical thinking === good software _Photo by [Unsplash](https://unsplash.com/@giamboscaro?utm_source=medium&utm_medium=referral" rel="noopener" target="_blank" title="">Giammarco Boscaro on <a href="https://unsplash.com?utm_source=me... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/the-philosophy-of-programming-e901bd37363a/</link>
                <guid isPermaLink="false">66c3620bc6c49ae59cf21afd</guid>
                
                    <category>
                        <![CDATA[ algorithms ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Computer Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 06 Jun 2018 16:32:17 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/0*GskYn20OaaZ4T3u6." medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Haoxian Chen</p>
<h4 id="heading-logical-thinking-good-software">Logical thinking === good software</h4>
<p><img src="https://cdn-media-1.freecodecamp.org/images/EZF4VCe2rJHLZDPrYv-sUBYvAxsRACQj6kV5" alt="Image" width="800" height="533" loading="lazy">
_Photo by [Unsplash](https://unsplash.com/@giamboscaro?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="_blank" title=""&gt;Giammarco Boscaro on &lt;a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral" rel="noopener" target="<em>blank" title=")</em></p>
<p>Programming is the new literacy. But how do we write good programs? Here are the recurrent questions we need to solve:</p>
<ul>
<li>How do we come up with algorithmic solutions to a problem?</li>
<li>Then, how do we know the solution actually works?</li>
<li>Even if we’re sure it works, how do we tell the computer to execute it?</li>
</ul>
<p>Fun fact — if you have hard time grinding any of these questions, you are actually doing philosophy.</p>
<p>To see why, let’s examine some interesting similarities between programming and philosophical reasoning.</p>
<h3 id="heading-the-first-principle-you-have-to-think-hard">The first principle: you have to think hard.</h3>
<p>Computers do nothing smarter than we can do — the difference is, they do it with faster speed.</p>
<p>But they cannot solve an actual problem like “how do I get to my office from home?”</p>
<blockquote>
<p>An effective method can (in principle) be carried out by a human being unaided by any machinery except paper and pencil.</p>
<p>— <a target="_blank" href="https://plato.stanford.edu/entries/church-turing/#ThesHist">The Church-Turing Thesis</a></p>
</blockquote>
<p>The merit of programming still lies in the reasoning part. That is, translating a real world problem into simple instructions that a computer can execute.</p>
<p>Of course, different programming languages have different levels of semantic abstractions. A Python program might be shorter than its C counterpart. But that just changes the amount of translations. We cannot get rid of the translation work. But we’ll leave this discussion for later.</p>
<h4 id="heading-a-programmers-reasoning-flow">A programmer’s reasoning flow</h4>
<p>Now we are staring at some problem description. We may first look for small-scale input-output examples to understand the problem:</p>
<p><strong>Induction.</strong> We need an algorithm that can handle such examples. Now you are doing induction: generalizing principles from experience.</p>
<p><strong>Deduction.</strong> How do we know if it works for other unknown input? We do deduction to prove the correctness of our algorithm.</p>
<p><strong>Ontology</strong>. We have to maintain data in computer memory. The goal is to make them efficient for the computers to process. In order words, what data structure can best capture the dynamic flow of my information?</p>
<p><strong>Induction again</strong>. Then comes the very final stage: debugging. We induce the buggy part of the program from analyzing the unexpected outputs.</p>
<h4 id="heading-an-example">An example</h4>
<p>Now let’s examine the above process by following this real example: finding the shortest path from vertex A to vertex E.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/Bs3KoOWL2idTBigI0y630wh78nK9Sdwtvdck" alt="Image" width="800" height="316" loading="lazy">
<em>A simple map. Numbers denote the edge distance.</em></p>
<p>For small scale problems, we can solve them by instincts. Like, it’s very straightforward for us to recognize the solution A-C-E just by looking.</p>
<p>But what about more complex topologies? What about different edge weights?</p>
<p>We need help from computers. Yet it’s not straight forward to tell a computer what to do. There is a gap between how humans think and how a computer works.</p>
<h3 id="heading-the-process">The process</h3>
<h4 id="heading-1-generalize-principles-from-experience-algorithms">1. Generalize principles from experience: algorithms</h4>
<p>To tell a computer what to do, we need to first come up with an algorithmic procedure.</p>
<p>Greedy strategies are a natural way to proceed. That is, starting from the source vertex A, and going all the way along the known shortest path. Keep exploring new vertices until we reach destination E. And indeed, this approach satisfies our example.</p>
<p>The intuition is that, along the shortest path to a destination, every intermediate node is visited in the shortest path as well. (Of course this intuition assumes that all edges have positive weights. This may not hold true, depending on the applications. We will discuss this in detail later).</p>
<p>So here is the algorithmic procedure:</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/OMYtQquoo-Owxbdgr0s8D270PknR9Ez-Zge5" alt="Image" width="521" height="518" loading="lazy">
_Dijkstra’s algorithm animation, by [Wikipedia](https://commons.wikimedia.org/wiki/User:Shiyu_Ji" rel="noopener" target="_blank" title=""&gt;Shiyu Ji from &lt;a href="https://commons.wikimedia.org/wiki/File:DijkstraDemo.gif" rel="noopener" target="<em>blank" title=")</em></p>
<ol>
<li>Some setup: (1) bookkeep the vertices we have visited: a set (<code>visited</code>), (2) remember the known shortest distances to each vertex that <strong>use only discovered vertices</strong>: another set <code>distance(u)</code>. Every vertex’s distance is initially infinity, except for the source vertex is 0.</li>
<li>Now we start exploring: first we <strong>visit</strong> the vertex that has the known shortest path so far, say it’s <code>u</code>. (Initially it would be the source vertex).</li>
<li>When standing at vertex <code>u</code>, we look around the out-going edges. Each edge, say<code>(u,v)</code>, gives us a path to vertex <code>v</code> that uses vertex <code>u</code> as the last but only one step. If any of them is indeed a shorter path to <code>v</code> , or the first path we found to <code>v</code>, hooray we can update our set of shortest paths now. Otherwise ignore and keep going.</li>
<li>We are done with vertex <code>u</code>, so we add it into our <code>visited</code> set.</li>
<li>Go back to step 2, keep exploring until we have visited all vertices.</li>
</ol>
<p><code>distance</code> can now tell us the global shortest distances, because it’s used to keep the shortest distances using only visited nodes. And all vertices are visited when the algorithm finishes.</p>
<p>We just reinvented Dijkstra’s algorithm. Of course, there are many other algorithms for finding the shortest path. But the point is, we need a algorithmic procedure to solve the problem.</p>
<h4 id="heading-2-validate-general-principles-by-deduction">2. Validate general principles by deduction</h4>
<p>How do we make sure the algorithm’s principles are correct? We can either increase our confidence by testing the principle against more input examples, or, more effectively, we can find a rigorous mathematical proof.</p>
<p>Like an <a target="_blank" href="https://www.iep.utm.edu/apriori/">a priori proposition</a> in philosophy, the correctness of an algorithm is independent of its execution. In other words, testing cannot guarantee the correctness of algorithms. We need to prove it.</p>
<p>Here’s the basic flow of the proof:</p>
<ol>
<li><p>For all visited vertices, we find the shortest paths.</p>
</li>
<li><p>The destination is visited.</p>
</li>
<li><p>Therefore, we find the shortest path to the destination.</p>
</li>
</ol>
<p>Don’t they seem somewhat familiar? Like this:</p>
<ol>
<li><p>All men are mortal.</p>
</li>
<li><p>Socrate is a man.</p>
</li>
<li><p>Therefore, Socrate is mortal.</p>
</li>
</ol>
<p>In fact, this is <a target="_blank" href="https://en.wikipedia.org/wiki/Syllogism">Syllogism</a>, a classic form of deductive reasoning. This is pretty much what logicians are doing.</p>
<p>Another interesting historical fact: the formal concept of computation was first come up by logicians in 1930s. They needed to know if certain logical problems are actually solvable at all (so they could avoid wasting their time solving something unsolvable). To answer that, they come up with the notion of computability.</p>
<p>Later in 1936, Alonzo Church and Alan Turing developed the formal definition of Computability, independently, at the same time. This <a target="_blank" href="https://onlinelibrary.wiley.com/doi/full/10.1002/0470018860.s00209">paper</a> gives a historical review of computation.</p>
<p>The conclusion’s correctness depends on the first two premises. In our proof, the second premise is trivial, since our algorithm is literally visiting all nodes. Yet proving the first premise, that we find the shortest path by the time we visit a node, needs some work.</p>
<p><strong>Mathematical induction</strong> can help. It is actually one of the most useful techniques to prove the correctness of a lot of other algorithms.</p>
<p>The general flow goes as follows. First, if an algorithm works on input <code>0</code>, and second, if the fact that it works on input <code>n</code> implies that it works on input <code>n+1</code> as well, then it works for all input greater or equal to <code>0</code>. At this point you are able to guarantee the correctness of your algorithm.</p>
<p>For simplicity, I’ll refer you to this <a target="_blank" href="http://www.cs.yale.edu/homes/spielman/365/shortestPaths.pdf">lecture note</a> for the complete proof of this path finding algorithm.</p>
<p>Note that we should not confuse mathematical induction and philosophical induction. By the philosophical definition, mathematical induction is a deductive reasoning process, because it’s correctness is contained in itself, without any external observations.</p>
<p>The lesson is: when we come up with an algorithm, it should be able to handle all possible execution cases.</p>
<p>In practice, going through the rigorous mathematical proof may not be the most efficient strategy. But at least we want to consider as many execution cases as possible, especially the adversarial ones. This practice would improve the robustness of our code.</p>
<p>You may have noticed that, in our example path finding algorithm, it doesn’t work if the edge weight is negative. You can find the reason in this <a target="_blank" href="http://www.cs.yale.edu/homes/spielman/365/shortestPaths.pdf">lecture note</a>. To handle a negative-weight graph, you can use the <a target="_blank" href="https://en.wikipedia.org/wiki/Bellman–Ford_algorithm">Bellman-Ford algorithm</a>.</p>
<h4 id="heading-3-the-ontology-problem-data-structure">3. The ontology problem: data structure</h4>
<p>So far we convinced ourselves that we have a correct algorithm. But this is only half the battle.</p>
<p>The next question is, how do we feed the information into computers? Humans like visualized information, like graphs, or histograms. But today’s computers only deal with binary bits.</p>
<p>We need to come up with a data structure that contains the essential information. And it should be efficient for a program to process at the same time.</p>
<p>Let’s continue on our path finding example. A path is an ordered list. But it’s irritating to deal with, compared to an integer. Note that in our algorithm we have to find the shortest path from our set of discovered paths. And then iterate all the way to its end. Seems like we have to dedicate an array or memory to store each path.</p>
<p>Could we do better? Note that in a valid path, consecutive appearances of elements must correspond to an edge in the graph. But, we already have the edge information and they are the same for all paths. Why can’t we get rid of this redundant information?</p>
<p>Well, we can get rid of the list. It turns out that in order to gather the shortest path, the intermediate step is to determine what is the next hop you need to go. All we need to retrieve the shortest path from source A to any target node is just the graph itself, and the shortest distance from A to every node.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/EVYvfP6tEU3yBZanFV-m8doAre-P8wWDbBeB" alt="Image" width="800" height="273" loading="lazy">
<em>Information to retrieve shortest path from A to any node. (Numbers within vertices denote the distance from A.)</em></p>
<p>A visual representation is in the above picture. This representation is memory efficient. It’s also more efficient for the program to process.</p>
<p>This is how it constructs the shortest path using only the distance vector. Start from the destination vertex, and an empty path. Look up intermediate vertices through incoming edges. Pick the one with the lowest value in <code>distance</code>. Add it to the head of the path. Repeat until we reach the source. This trick actually has a formal notation, called <a target="_blank" href="https://en.wikipedia.org/wiki/Backtracking">back-tracking</a>.</p>
<p>Philosophers seek for the eternal truth. And programmers want to find out the precise data structure that best captures the dynamics of information. As you see in the path finding example, all it needs to give a shortest path is just a vector, telling you the shortest distances to each vertex. This holds true for any graph, regardless of the number of vertices or edges.</p>
<h4 id="heading-4-a-posteriori-proposition-debugging">4. A posteriori proposition: debugging</h4>
<p>Most programmers have gone through this reasoning tons of times. I bet this is one of the most difficult and time-consuming part of any programming task.</p>
<p>For example, segmentation faults in C programs are often caused by null pointer references. I learned this after dealing with tons of C/C++ segmentation faults. Of course, there are more subtle cases that relate to personal programming habits.</p>
<p>The following example is a syntax mistake made by a programmer. The if condition should have been <code>is_float==1</code> , but the programmer mistook the logical equal operator <code>==</code> as an evaluation operator <code>=</code>. This will still pass the compiler’s check, because either is correct syntax.</p>
<pre><code><span class="hljs-keyword">if</span> (is_float = <span class="hljs-number">1</span>) {  <span class="hljs-comment">// do something}</span>
</code></pre><p>This is an inductive reasoning process. Your debugging diagnosis only makes sense if you have observed enough program executions.</p>
<p>Here is where the value of practice comes in. No matter what kind of techniques you are learning, you have to gather enough practical data. Otherwise, you wouldn’t have enough experience to conduct induction.</p>
<p><strong>You should keep an eye on the recurrent patterns in your buggy codes.</strong> When you find a bug, fixing it is not enough. You need some extra cause-effect analysis on your own programming practice. Ask yourself: is this part of my programming habits particularly vulnerable to these kinds of bug?</p>
<h3 id="heading-so-why-does-it-matter">So why does it matter?</h3>
<p><strong>Programming is not just about writing code, it’s a systematical way of reasoning.</strong> Because code, or instructions, is just a means to an end. With the development of program synthesis technique, you may not even bother writing code and debugging yourself. All that matters is if you can tell the computer what to do.</p>
<p>As the first step towards improving your programming skills, this article reveals the underlying reasoning pattern that we may not even recognize when we were programming. Most of us rely on subconscious, automatic reflection to finish most of our day-to-day tasks. But where does improvement come from? It first comes from noticing some fallacy or mistakes we made in our reasoning process.</p>
<p>For practical advice, I recommend this article on <a target="_blank" href="https://medium.freecodecamp.org/how-to-think-like-a-programmer-lessons-in-problem-solving-d1d8bf1de7d2">how to think like a programmer</a>, and this <a target="_blank" href="https://www.amazon.com/Think-Like-Programmer-Introduction-Creative/dp/1593274246">book</a> on the same topic but with more details.</p>
<h4 id="heading-references">References</h4>
<ul>
<li><a target="_blank" href="https://onlinelibrary.wiley.com/doi/full/10.1002/0470018860.s00209">Computation, Philosophical Issues about.</a> Matthias Scheutz.</li>
<li><a target="_blank" href="https://plato.stanford.edu/entries/church-turing/#ThesHist">The Church-Turing Thesis</a>.</li>
<li><a target="_blank" href="https://www.amazon.com/Think-Like-Programmer-Introduction-Creative/dp/1593274246">Think Like a Programmer: An Introduction to Creative Problem Solving</a>. V. Anton Spraul.</li>
</ul>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Descartes, Berkeley and Functional Reactive Programming ]]>
                </title>
                <description>
                    <![CDATA[ By David Valdman Functional reactive programming is laden with unfamiliar terminology to the newcomer: pure functions, immutability, monads, etc. But beneath these concepts is a deeper principle — one debated long before Charles Babbage and the first... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/descartes-berkeley-and-functional-reactive-programming-18b0b61eac58/</link>
                <guid isPermaLink="false">66c349038cfe41ff707fbe31</guid>
                
                    <category>
                        <![CDATA[ Computer Science ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Functional Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ JavaScript ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Reactive Programming ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 07 Sep 2016 13:46:42 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*eZcgzUUKk-PnETNqIXMfcw.png" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By David Valdman</p>
<p>Functional reactive programming is laden with unfamiliar terminology to the newcomer: pure functions, immutability, monads, etc. But beneath these concepts is a deeper principle — one debated long before Charles Babbage and the first computers. I argue the difference between object-oriented programming (OOP) and functional reactive programming (FRP) is as much about interpretations of reality as it is about structures of programs.</p>
<p>Here’s a thought experiment we’ve all likely heard:</p>
<blockquote>
<p>If a tree falls in the middle of a forest, and no one is there to hear it, does it make a sound?</p>
</blockquote>
<p>There are many of ways to attack this question as ill-posed. Ignoring them for the moment, this question is poking at a fundamental aspect of reality: causality. Is existence dependent on, or independent of, observation? Let’s translate this thought experiment into code. Here’s a <strong><em>tree</em></strong>:</p>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Tree</span> </span>{     <span class="hljs-keyword">constructor</span>(){         <span class="hljs-built_in">this</span>._fell = <span class="hljs-literal">false</span>;     }     <span class="hljs-keyword">set</span> <span class="hljs-title">fell</span>(<span class="hljs-params">state</span>){         <span class="hljs-built_in">this</span>._fell = state;     }     <span class="hljs-keyword">get</span> <span class="hljs-title">fell</span>(){         <span class="hljs-keyword">return</span> <span class="hljs-built_in">this</span>._fell;     }}
</code></pre><pre><code><span class="hljs-keyword">var</span> tree = <span class="hljs-keyword">new</span> Tree();tree.fell = <span class="hljs-literal">true</span>;
</code></pre><p>To make the <strong><em>tree</em></strong> fall we set its fallen state to <strong><em>true</em></strong>. This is textbook object-oriented programming. Its patterns are getters, setters, and state. Simple enough, but in the context of our thought experiment there is a lurking interpretation: if one questions whether the tree fell, even if they didn’t observe it, the answer is a resounding “<em>Yes!</em>” One only needs to check that <strong><em>tree.fell</em></strong> is <strong>true</strong>. Those that answer <em>yes</em> to our philosophical question do so because they can return to the forest, see the fallen tree, and deduce it fell in the past. Here is the codified equivalent. Looks like we’ve solved that centuries-old riddle.</p>
<p>Not so fast! Let’s look at a different approach. Here’s another <strong><em>tree</em></strong>:</p>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Tree</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">EventEmitter</span> </span>{}<span class="hljs-keyword">var</span> tree = <span class="hljs-keyword">new</span> Tree();tree.emit(<span class="hljs-string">'fall'</span>);
</code></pre><p>This is the “reactive” <strong><em>tree</em></strong>. Its patterns are events and transforms. In its purest form our tree maintains no state. We make it fall by broadcasting a <strong><em>fall</em></strong> event. Alas, the message falls on deaf ears! No state has changed, no evidence is left. There is no way to deduce the past by querying reality. Did the tree fall? <em><em>shrug</em></em></p>
<h3 id="heading-descartes-and-berkeley">Descartes and Berkeley</h3>
<p>The object-oriented and reactive approaches give two different answers to our thought experiment because they embody two contradictory philosophies of epistemology: Rationalism, popularized by Descartes in the late 1600s, and Empiricism popularized by Berkeley in the early 1700s.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/1w0HHnALKtOg8UIL9dyDfrziVVwwfTj7f2eh" alt="Image" width="728" height="200" loading="lazy">
<em>Descartes takes as a short break from writing a Java interface</em></p>
<p>Descartes, in a streak of fanatical skepticism, found he could only be sure of one thing: his own existence. He came to this conclusion because he couldn’t doubt the existence of his thoughts and concluded there must be some entity doing the thinking, thus coining the phrase, <em>cogito ergo sum</em>: I think therefore I am. In other words: by acknowledging that there is some internal state that is changing, there must be some agent for whom the state belongs. To Descartes, changes of state is proof of existence — just like our first <strong><em>tree.</em></strong></p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/9jQ6H6ZLd-xgha0AWrT7PfFvfickuVBakznO" alt="Image" width="728" height="200" loading="lazy">
<em>Berkeley seen pondering Haskell type definitions</em></p>
<p>Soon after Descartes comes George Berkeley. Berkeley denounced the realist’s view. To Berkeley, it made no sense for material objects, like trees, to have existence. Existence only comes to us through thoughts (mental as opposed to physical experience), and thoughts must assimilate in the mind to exist. Material objects are deceptions; their essence is not their physicality but their ability to transform the immaterial. If a thought is not assimilated in the mind, it has no existence. Thus he popularized the Latin phrase <em>esse percepi</em>: to be is to be perceived.</p>
<p>Let’s translate Berkeley’s reality into code. For our second <strong><em>tree</em></strong> to make a sound a mind must interpret it. We will create a chain of causality, starting from the tree falling, to the air vibrating, to the ear creating an electrical stimulus, to the brain interpreting it as sound.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/XlaPm5rC3NWvz16x-OUYLTNSJF40VjosKvlC" alt="Image" width="800" height="200" loading="lazy"></p>
<p>When the tree falls, the air vibrates.</p>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Air</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">EventEmitter</span> </span>{    <span class="hljs-keyword">constructor</span> (){        <span class="hljs-built_in">super</span>();                <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">mapFall</span> (<span class="hljs-params">fall</span>)</span>{...}        <span class="hljs-built_in">this</span>.on(<span class="hljs-string">'fall'</span>, <span class="hljs-function">(<span class="hljs-params">fall</span>) =&gt;</span> {            <span class="hljs-keyword">var</span> vibration = mapFall(fall);            <span class="hljs-built_in">this</span>.emit(<span class="hljs-string">'vibrate'</span>, vibration);        };    }}
</code></pre><p>When the air vibrates, the ear converts it to an electrical stimulus.</p>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Ear</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">EventEmitter</span> </span>{    <span class="hljs-keyword">constructor</span> (){         <span class="hljs-built_in">super</span>();                <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">mapFrequency</span> (<span class="hljs-params">frequency</span>)</span>{...}        <span class="hljs-built_in">this</span>.on(<span class="hljs-string">'vibrate'</span>, <span class="hljs-function">(<span class="hljs-params">frequency</span>) =&gt;</span> {            <span class="hljs-keyword">var</span> stimulus = mapFrequency(frequency);            <span class="hljs-built_in">this</span>.emit(<span class="hljs-string">'stimulus'</span>, stimulus);        };    }}
</code></pre><p>When ear creates a stimulus, the brain interprets it as sound.</p>
<pre><code><span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Brain</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">EventEmitter</span> </span>{    <span class="hljs-keyword">constructor</span> (){        <span class="hljs-built_in">super</span>();        <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">mapStimulus</span> (<span class="hljs-params">signal</span>)</span>{...}        <span class="hljs-built_in">this</span>.on(<span class="hljs-string">'stimulus'</span>, <span class="hljs-function">(<span class="hljs-params">signal</span>) =&gt;</span> {            <span class="hljs-keyword">var</span> sound = mapStimulus(signal);            <span class="hljs-built_in">this</span>.emit(<span class="hljs-string">'sound'</span>, sound);        };    }}
</code></pre><p>We have effectively set up a chain of causality, which we make explicit by building a pipeline:</p>
<pre><code>tree.pipe(air).pipe(ear).pipe(brain);
</code></pre><p>Now, when the tree falls it makes an impression on a mind:</p>
<pre><code>brain.on(<span class="hljs-string">'sound'</span>, <span class="hljs-function">(<span class="hljs-params">sound</span>) =&gt;</span> {    <span class="hljs-comment">// We exit the system. You have been heard!    console.log(sound); });</span>
</code></pre><pre><code>tree.emit(<span class="hljs-string">'fall'</span>, fallData);
</code></pre><p>Berkeley called this concept <em>Subjective Idealism</em>. <em>Idealism</em> because it asserts only thoughts or ideas exist, and <em>subjective</em> because reality is dependent on the subjects that perceive it. In my opinion, Subjective Idealism is the philosophy underpinning reactive programming. Berkeley writes,</p>
<blockquote>
<p>It is indeed an opinion strangely prevailing amongst men, that houses, mountains, rivers, and in a word all sensible objects have an existence natural or real, distinct from their being perceived by the understanding. …For what are the fore-mentioned objects but the things we perceive by sense…and is it not plainly repugnant that any one of these or any combination of them should exist unperceived?</p>
</blockquote>
<p>I love this quote for its self-assured audacity. Berkeley is essentially calling us crazy for thinking that houses, mountains and rivers exist. In our example, trees, air, ears and brains are false idols; the only reality is <strong><em>mapFall</em></strong>, <strong><em>mapFrequency</em></strong> and <strong><em>mapStimulus</em></strong>. Reality is then never consumed, as it is with objects when they retain state. Reality is merely transformed.</p>
<h3 id="heading-subjective-idealism-in-practice"><em>Subjective Idealism</em> in Practice</h3>
<p>In OOP we create objects that encapsulate some kind of behavior. We then construct programs which are networked relationships of these objects. Our program is structurally a <em>graph</em>.</p>
<p>In FRP we create pipelines of functions that encapsulate causal relationships. Pipelines are then merged and branched to give the graph-like structure of an object-oriented program. However, there is an important limitation on the types of functions. Only <a target="_blank" href="https://en.wikipedia.org/wiki/Pure_function">pure functions</a> are allowed. That is, functions that cannot effect anything outside themselves. In our example, the <strong>Ear</strong> object cannot change how the <strong>Air</strong> object vibrated. This constraint ensures that our pipelines have a well-defined direction from cause to effect. In terms of structure, this means our program is a <a target="_blank" href="https://en.wikipedia.org/wiki/Directed_acyclic_graph"><em>directed acyclic graph</em></a> (DAG).</p>
<p>To reason about software, we must think of it as a sequence of causal relationships. We must be able to <em>order</em> the program. Mathematically, a graph can be <a target="_blank" href="https://en.wikipedia.org/wiki/Topological_sorting">ordered</a> if and only if it is a DAG. This is true no matter how you write your program. Whether you choose OOP, FRP or XYZ. What’s special about FRP, though, is that ordering is enforced by the pattern.</p>
<p>In OOP, ordering is left unspecified. Objects can call methods on other objects. Objects can change the state of other objects. Everything has read and write privileges by default. Specifying an order is done manually by the developer. It is up to them to relate the sequential ordering of lines in a program to an ordering of the objects’ causal relationships.</p>
<p>Unfortunately, this is all too easy to mess up. Notice that in OOP, when two objects write to the same shared state, you have a race condition. In FRP, when two functions try to affect one another you have an infinite loop. This is but one example of a theoretical pattern enforcing a practical result.</p>
<p>The bottom line is that it is not enough to encapsulate state. A well-written program will also encapsulate dependency.</p>
<h3 id="heading-tradeoffs"><strong>Tradeoffs</strong></h3>
<blockquote>
<p>“Programmers know the benefits of everything and the tradeoffs of nothing.”— Rich Hickey</p>
</blockquote>
<p>You’d think after all this FRP praising and OOP bashing, I’d be firmly in the FRP camp. You’d be wrong! FRP is a programming pattern, and patterns serve to constrain solutions. If the ideal solution doesn’t satisfy the constraints, you’ll be wasting energy fighting against the pattern.</p>
<p>To be concrete, there are a few simple annoyances of FRP. Take immutability — you are always creating more memory. You can never, say, sort a list in place. You will always be creating a new list. In theory, immutability is a good pattern to observe. In practice, you may be memory constrained, and it may be a good idea to swim against the FRP current.</p>
<p>But this is not <em>the</em> glaring problem. The glaring problem is that FRP becomes an anti-pattern when you don’t know when two parts of a codebase will interact. Take, for example, a first person shooter game. Somewhere is a <strong>bullet</strong> object, and somewhere else is a <strong>player</strong> object. A bullet may hit a player, but it’s unclear when this will happen. These objects need to retain state (velocity of the bullet, health of the player, etc.) so it is available at the moment they interact. Perhaps in the abstract the entire game can be thought of as one causal pipeline, but that sounds more daunting to me than thinking in terms of decoupled objects and state.</p>
<p>To put on my philosophical hat once more, physics may decree that reality is one causal pipeline whose time evolution is governed by deterministic physical laws, and whose initial conditions (or probabilities) are provided by the big bang. But this is hardly how humans reason about cause and effect. We naturally slice up reality into higher-level objects and reason about their inter-relations. It can be simpler that way, even though it’s error prone!</p>
<p>I feel this is why FRP hasn’t been been wholly embraced by the programming community, even after seeing its many advantages. The best we should hope for when writing programs is to use FRP principles in places where its patterns fit the solution, and let them inspire OOP patterns where its patterns do not. To me this is a distinction between solutions that can be thought of as pipelines, and solutions that shouldn’t be.</p>
<h3 id="heading-conclusion">Conclusion</h3>
<p>In philosophy the objective is not to solve our deepest problems, but to have a shared language and historical precedent to debate them. So when a new problem emerges, we don’t have to start over. Similarly for programming patterns. They are not used to decide right and wrong, as if these concepts have universal appeal. They are used to classify problems and their approaches.</p>
<p>We should also look to other disciplines, much older than computer science, to see whether their shared language and historical precedent can inspire our own. Then we may see that the question, “<em>did the tree fall?</em>” is not answered with a <em>yes</em> or a <em>no</em>. That instead it questions a perspective. One that can frame our philosophy of epistemology or our architecture of programs. And one to which the answer lies between a state of mind, and a flow of thought!</p>
<p><strong>Preview of Part II</strong></p>
<p>There is still a nagging dilemma in our thought experiment. Even if there are no people to experience the sound, surely when the tree falls the air must vibrate! Right? In Part II we will go further down the rabbit hole to see that FRP can give a surprising interpretation here too. We’ll think of data flows in terms of push vs pull and see how this appears in concepts like lazy evaluation, algorithms like ray tracing, and applications like Excel.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ We have been programming for thousands of years ]]>
                </title>
                <description>
                    <![CDATA[ By Tautvilas Mečinskas Computer programs are all around us. We interact with them every day. It looks as if software is becoming more and more important to our society. But why do we find programs so necessary to us? Why and when did we start program... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/what-is-programming-22a72ef4fd02/</link>
                <guid isPermaLink="false">66c365b6139b845d61e84bb8</guid>
                
                    <category>
                        <![CDATA[ history ]]>
                    </category>
                
                    <category>
                        <![CDATA[ language ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ technology ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Thu, 19 May 2016 12:30:43 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*baG6RijcVa8LysywkCpN8g.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Tautvilas Mečinskas</p>
<p>Computer programs are all around us. We interact with them every day. It looks as if software is becoming more and more important to our society. But why do we find programs so necessary to us? Why and when did we start programming? What is the essence of programming? These questions might sound trivial, but I feel that today we still don’t have a good definition of what programming is. Maybe this post can help to change that.</p>
<p>It is pretty hard to define programming because it is so diverse. One can program games, mobile apps, websites, compilers, simulations and much more. In this case it might be helpful to start by breaking down some misconceptions and clarifying what programming is not.</p>
<p><em>Programming is not science.</em> Science is the art of examining the world and discovering repeatable patterns in it. The scientific method is about making a hypothesis, and then performing experiments to prove or reject it. We don’t use such a method in programming — thus it is not science. Programming is not about discovery, but creativity.</p>
<p><em>Programming is not math.</em> Yes, there is an aspect of math to programming. Some parts of programs can be expressed as mathematical functions. Writing a Fibonacci number generator is fun, but completely useless without a real-world application. Math in programming is means to an end, not a core part of the process.</p>
<p><em>Programming is not about electronic computers.</em> Computers are very useful, but not necessary. Programs can be understood and interpreted by human beings as well. Therefore, computers are just tools we use in programming.</p>
<p>So what is programming about? What is at the core of every program — big or small?</p>
<p>Abstractions.</p>
<p>What is abstraction? It is a reduced image of the world. When abstracting, we are converting reality into symbols which can be transmitted as information. The word <em>abstraction</em> originates from two Latin words, which are <em>abs,</em> meaning <strong>away from</strong> and <em>trahere,</em> meaning <strong>to draw</strong>. The Latin translation suggests that abstracting implies separating one from the whole.</p>
<p>Is the process of abstraction unique to programming? Not really. It is something that humans have been doing for quite some time now. And our most basic tools of abstraction are the map and the clock.</p>
<p>Archaeologists have discovered stone maps that humans made <a target="_blank" href="http://www.telegraph.co.uk/news/worldnews/europe/spain/5978900/Worlds-oldest-map-Spanish-cave-has-landscape-from-14000-years-ago.html">more than 14,000 years ago</a>. This shows that map-making is fundamental to humans. It is a process of transforming territory into symbols by abstracting it. A map is a way to abstract space. It is a tool that helps us to make sense of surrounding territory so that navigating it will be easier.</p>
<p>A clock, on the other hand, is a way to abstract time. We find the continuous nature of time confusing, so we abstract it. Humans split time into discrete intervals: years, months, days, hours, minutes, seconds. While a map helps us navigate space, a clock helps us navigate time. The predecessor of the clock — the calendar — emerged <a target="_blank" href="http://gizmodo.com/archaeologists-discover-worlds-oldest-calendar-in-scotl-922374641">more than 10,000 years ago</a>.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/K2-yzsletJjBjTnKwA7kvn4sz4Ynu1UOC3ou" alt="Image" width="800" height="587" loading="lazy">
_Giant solar calendar [Chankillo](https://en.wikipedia.org/wiki/Chankillo" rel="noopener" target="<em>blank" title=") was built 2,300 years ago.</em></p>
<p>What about computers then? They are also tools that deal with abstractions. There are 3 fundamental parts to every computer:</p>
<ol>
<li>Internal clock — a computer’s way to abstract time</li>
<li>Memory — a computer’s way to abstract space</li>
<li>Processing unit —a computer’s way to perform logical operations</li>
</ol>
<p>These facilities give computers a way to understand space abstractions and their interactions in abstracted time. This means that programs are abstractions of spacetime, and programming is the art of creating spacetime abstractions. These abstractions help us to navigate reality, and that is why they are so important to us.</p>
<p>And there is one abstraction method that is very similar to programming, but is even older than maps, clocks and calendars: language.</p>
<p>If you look closer at our natural language, you will see that it has all the features necessary to abstract spacetime.</p>
<p>Let’s look at an example sentence:</p>
<blockquote>
<p>Go to the garden and pick up some flowers this evening.</p>
</blockquote>
<p><strong>The garden</strong> and <strong>flowers</strong> refer to abstracted space. <strong>This evening</strong> is a way to abstract time. <strong>And</strong> adds logic to the sentence. <strong>Go to</strong> and <strong>pick up</strong> are subroutines.</p>
<p>We can easily transform the sentence above into JavaScript:</p>
<pre><code>whenEvening.then(<span class="hljs-function">()=&gt;</span>you.goTo(garden)).then(<span class="hljs-function">()=&gt;</span>you.pickUp(flower))
</code></pre><p>This sentence can be understood by a computer that has definitions of <strong>evening</strong>, <strong>you</strong>, <strong>flowers,</strong> and the necessary subroutines defined.</p>
<p>The problem with natural language is that it has very broad applications. Language can be used not only to communicate information, but also to express feelings and emotions. The best examples of pure natural language programs are laws, board game rules, and instruction manuals.</p>
<p><img src="https://cdn-media-1.freecodecamp.org/images/xQoLcFFm2PL69Hv3LpF1saAtoAn86lGejQ99" alt="Image" width="640" height="423" loading="lazy">
_[ CC BY-NC-SA](https://en.wikipedia.org/wiki/Code_of_Hammurabi" rel="noopener" target="_blank" title=""&gt;Code of Hammurabi is one of the oldest natural language programs (photo by <a href="https://www.flickr.com/photos/prof_richard/" target="_blank">Richard</a> /&lt;a href="https://creativecommons.org/licenses/by-nc-sa/2.0/" rel="noopener" target="<em>blank" title="))</em></p>
<p>Programming languages, on the other hand, are strict and can only create abstractions. Computers are designed to interpret these abstractions in a very specific and deterministic way.</p>
<p>In order to write computer programs one has to learn how to encode natural language to symbols that computer can understand. This usually requires intricate knowledge of computer architecture and the syntax of the chosen computer language. Thus if you want a computer to understand your reality abstractions, you have to learn how to code.</p>
<p>Computers are tools that can execute rules defined in programs with superhuman speed and precision. They empower us with the ability to construct complex, multilayered abstractions, and transform our programs into truly dynamic and interactive maps of reality.</p>
<p>In many ways, programming is something that all of us already know how to do. The process of reality abstraction is fundamental to human beings. Computer programming is just the most effective way of doing this.</p>
 ]]>
                </content:encoded>
            </item>
        
            <item>
                <title>
                    <![CDATA[ Perlis on Coding Joy (+ 10 Epic Epigrams) ]]>
                </title>
                <description>
                    <![CDATA[ By Den McHenry Alan J. Perlis was the first recipient of the Turing Award. He’s possibly most remembered today for his Epigrams on Programming, which are still brilliant and instructive more than three decades on. One of my favorite quotes not from t... ]]>
                </description>
                <link>https://www.freecodecamp.org/news/perlis-on-tech-evangelism-10-epigrams-5ea6dcf3faf5/</link>
                <guid isPermaLink="false">66c35c89e335b31297533f73</guid>
                
                    <category>
                        <![CDATA[ Life lessons ]]>
                    </category>
                
                    <category>
                        <![CDATA[ Philosophy ]]>
                    </category>
                
                    <category>
                        <![CDATA[ General Programming ]]>
                    </category>
                
                    <category>
                        <![CDATA[ self-improvement  ]]>
                    </category>
                
                    <category>
                        <![CDATA[ tech  ]]>
                    </category>
                
                <dc:creator>
                    <![CDATA[ freeCodeCamp ]]>
                </dc:creator>
                <pubDate>Wed, 30 Dec 2015 18:51:45 +0000</pubDate>
                <media:content url="https://cdn-media-1.freecodecamp.org/images/1*QkGJGhS7wCPoq09rkLC_JQ.jpeg" medium="image" />
                <content:encoded>
                    <![CDATA[ <p>By Den McHenry</p>
<p>Alan J. Perlis was the first recipient of the Turing Award. He’s possibly most remembered today for his <a target="_blank" href="http://www.cs.yale.edu/homes/perlis-alan/quotes.html"><em>Epigrams on Programming</em></a>, which are still brilliant and instructive more than three decades on.</p>
<p>One of my favorite quotes not from the <em>Epigrams</em> is about staying engaged in the actual business of learning, practicing, and — most importantly—enjoying computer programming.</p>
<blockquote>
<p><em>I hope the field of computer science never loses its sense of fun. Above all, I hope we don’t become missionaries. Don’t feel as if you’re Bible salesmen. The world has too many of those already. What you know about computing other people will learn. Don’t feel as if the key to successful computing is only in your hands. What’s in your hands, I think and hope, is intelligence: the ability to see the machine as more than when you were first led up to it, that you can make it more.</em></p>
</blockquote>
<p>— Alan Jay Perlis</p>
<p>Here are a few of his epigrams to whet your appetite:</p>
<blockquote>
<ol start="7">
<li><p>It is easier to write an incorrect program than understand a correct one.</p>
</li>
<li><p>Recursion is the root of computation since it trades description for time.</p>
</li>
<li><p>There will always be things we wish to say in our programs that in all known languages can only be said poorly.</p>
</li>
<li><p>Programmers are not to be measured by their ingenuity and their logic but by the completeness of their case analysis.</p>
</li>
<li><p>Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy.</p>
</li>
<li><p>Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.</p>
</li>
<li><p>In programming, as in everything else, to be in error is to be reborn.</p>
</li>
<li><p>When someone says “I want a programming language in which I need only say what I wish done,” give him a lollipop.</p>
</li>
<li><p>Don’t have good ideas if you aren’t willing to be responsible for them.</p>
</li>
<li><p>Dealing with failure is easy: Work hard to improve. Success is also easy to handle: You’ve solved the wrong problem. Work hard to improve.</p>
</li>
</ol>
</blockquote>
<p>If you happen to use WordPress and want to read some more Perlis right in your dashboard, check out my plugin <a target="_blank" href="https://github.com/denmch/hello-perlis"><em>Hello Perlis</em></a>, adapted from Matt Mullenweg’s <em>Hello Dolly</em> plugin.</p>
 ]]>
                </content:encoded>
            </item>
        
    </channel>
</rss>
