1461

27
+18  Q:

## How to explain to your mom what an algorithm is?

How do you explain to your mom what an algorithm is? My family is mostly non-technical, and they don't really understand what programming is, or what an algorithm is. I tried the old cooking recipe analogy, but are there better ways to explain what we do and how we think?

Update: There are some really good answers so far that explain how many procedures that she would know from her every-day life are in fact algorithms. However, now it's understandable, but it sounds dull and boring. I'd be interested in explanations that capture the beauty of algorithms and the creativity that's required in programming. That would be something my parents could relate to.

Maybe something along the lines: Programming is like composing a piece of music? (But can the two really be related?) Are there more explanations from that point of view?

+1  A:

Easy: it is like a recipe to do something. Having to do with computers, it is normally related to calculating something, or finding elements in a database or set of records, but very similar to a recipe in essence.

Although my very first idea on it, too, recipe analogy is *not* what is asked for here. Read the question thoroughly.
A:

I feel you. My parents don't even own a computer. I'd tell them that an algorithm is simply a way to get from A to B.

A:

I think some very simple pseudocode can go a long way:

``````function addtwonumbers(a, b)
return a + b
end function
``````

This is fairly self-explanatory. You don't have to understand programming to see how it works.

My parents would say: "I see that it's adding numbers, but what is it good for?" It doesn't explain the beauty of algorithms. It doesn't convey what we're doing. It's as if a novelist says: Look, take this subject and verb and you have a sentence. He should be talking about the spirit of his novels.
agreed with dehmann
True, there is probably a limit to how well we can communicate the subtleties of programming.
That's a calculation, rather than an algorithm
al⋅go⋅rithm: a set of rules for solving a problem in a finite number of steps, as for finding the greatest common divisor.... The definition does not state anything about the complexity of the problem or the number of steps.
+1  A:

Usually you simply don't explain, they don't need to know =).

Edit.:

Let me explain myself.:

Saying that you do algorithms isn't that informative and interesting at all. I think its better to say what problems did you solved by using algorithms like.: "Hey, I've made a program that can compute the shortest route between two cities of xyz region."

Sure they need to know. They want to be involved with their children's lives and care about their interests after all they've been through with raising them.
I agree in parts. Saying that you do algorithms isn't that informative and interesting at all.I think its better to say what problems did you solved by using algorithms like.: "Hey, I've made a program that can compute the shortest route between two cities of xyz region."
+2  A:

If the recipe analogy doesn't work then explain it like this. When you taught me how to crawl and walk; you just showed me the concepts and I put the pieces together. As a programmer you do both, the concept (algorithm) piecing it together (making the program).

+3  A:

It's just a series of steps.

You could easily show how doing the laundry is an algorithm. Now, imagine you're doing laundry at a laundromat. You can do some steps in parallel and start to understand things like Amdahl's Law. If you think of the larger process like getting dirty clothes, washing them, drying them, folding, and then putting them away, it's easy to see how this creates a pipeline just like an execution pipeline in a modern CPU.

(This analogy is elaborated on in detail in Patterson and Hennessy's great Computer Architecture book.)

Updated response:

Expanding on the analogy you could quote Alan Kay: "a computer is an instrument whose music is ideas."

Algorithms help save UPS money by calculating how to only make right hand turns, they help you find a movie you might like and they give Walmart the insight to stock extra strawberry Pop Tarts when a hurricane is coming.

But ultimately it comes down to a series of steps. Where those steps lead is up to your imagination.

The pop tart example is great!
+7  A:

If I were absolutely forced to explain it I would take the approach of asking her to explain the steps of some process she knows how to do. Ask her a few clarifying questions until you can explain it back to her, then show her how that's an algorithm.

Truthfully, I don't often explain what I do to non-technical people. I write software for robots and unmanned vehicles for a living and although that sounds cool on the surface, it's difficult to explain. I usually tell people I make toasters.

Response to updated question: If you want to understand the link between algorithmic thinking and music, I recommend Gödel, Escher, Bach: an Eternal Golden Braid by Douglas Hofstadter. It's a good enough read that you can recommend it to your family members who are interested as well.

I like the part about forcing her to describe a task she does, reducing it down to core elements and explaining it back to her. +1
@Simucal: Thanks. This approach removes the problem of figuring out something that everyone can understand. Instead, ask the person for one thing *they* understand.
+1  A:

Make an analogy to physics or natural sciences.

Most people don't understand higher math or deep physics, but they understand that nature is beautiful, amazing, and "useful."

The study of algorithms is the same as the study of nature, physics, or even more abstract things like higher mathematics.

It's just that instead of the "rules" of physics, it's the "rules" of the machines we call computers.

+1  A:

I think driving somewhere is a good analogy for a simple algorithm. Ask her to explain how to get from your house to the supermarket, and explain how that is similar to the rules put into a computer program.

+3  A:

Tell her you are a sort of "virtual clocksmith" (she should atleast know what a clocksmith is). Basically instead of using gears you control the flow of electricity, through programming, to make computers do useful stuff like email and Internet.

That is a fairly accurate description of our job.

Update: About creativity, our job is not like music or painting, because those endevours are first and foremost about self expression and feelings, we don't express our feelings through our work, we express our ingenuity.

So we are inventors and craftsmen, not artists. Like craftsmen we pick the right tools and right materials, other peoples algorithms, and like inventors make new machines and tools to make peoples jobs easier, we make improve (hopefully!) the uses of computers, to do the boring stuff humans don't want to do.

Ha, I like that (minus the fact that it doesn't look like a creative job, see my Update), I recently thought I'd like to be a clocksmith!
Yeah I wanted to be a clocksmith as a child :)
Of course you can create art with code. But given that most people would rather make money off their work, it's not very popular.
You can make art with code, and the workmanship of good programmers can be beautiful, however those are not inherent traits of code, any more than Urinals are art( look this up ). We are programmers and our job is to create solutions, not art. But you're free to do as you like, with your free time.
If large hordes of mercenary programmers often create giant heaps up ugly code, it stands to reason that some programmers, given the same requirements, could possibly create something beautiful. It may not be 'art' per se, but what isn't these days?
+1  A:

I would compare it to a flowchart. (http://upload.wikimedia.org/wikipedia/commons/9/91/LampFlowchart.svg)

+8  A:

A cooking recipe is not analogous to an algorithm. A recipe is an algorithm. It is the perfect way to explain algorithms to non-technical people, particularly many moms.

So explaining what an algorithm is is fairly easy. Maybe you really want to explain something more general, like programming, or software development, or something like that. In that case some simple pseudocode might help. Something simple yet concrete, like searching for a name in a list.

``````for each customer in alphabetical order
if the customer's last name is the one we're searching for
then print the customer's full name and address and finish
``````

Once they get this you can start explaining about binary search, hash tables and red-black trees. :)

+3  A:

First of all, have her think of the algorithm's requirements as a shopping list for the grocery store. This will help her understand the purpose of an algorithm.

An algorithm is the quickest way to send someone else to the store to retrieve all the items from the shelves, pay for them, and bring the items them home and put them away.

Have her think about how the "algorithm" might change if you went to a different store than you normally go to, if they're out of an item on your list, if the shopping cart fills up, etc.

That's very sexist. How do you know the Dad doesn't do the shopping? :-)
He asked how I would describe it to *my* Mom. Not your mom. Mine loves to shop, groceries or otherwise.I think Dave Chappelle says it best when he says "Women be shoppin'"
Did I mention that the algorithm is to send "Dad" to the grocery store ;-)
+1 for the simple beauty of the example
@Pax this is a *programming* site... of course its sexist.
+4  A:

My mom used to tell me it was a bad idea to leave the power outlets on with nothing plugged in, since the electricity would leak out and ruin the floorboards. So I'd probably steer clear of explaining something like algorithms to her :-).

However, I have explained a program (just a bunch of algorithms in computer-readable form, after all is said and done) to my 4yo son and he seemed to get it pretty well. I described computers as being very fast but very dumb (or rote) and an algorithm as a set of instructions for a computer to follow to follow, and gave him the three basic 'parts' of code, sequence, selection and iteration.

Of course I then had to explain those three things in terms he could understand and that's the key. Find something your target audience knows and map the concepts to that. For my son, that's Jungle Soccer (the kiddie league).

The algorithm was easy, just explained as trying to get the ball from wherever it is into your goal as many times as possible. Sequence was explained as dribbling the ball closer to your goal and eventually kicking it in.

Selection was similarly easy; at any point you can decide to keep dribbling or pass it to a team mate. The "if-statement" here usually involves how many of the opposing team are trying to get the ball from you and, in Jungle Soccer, that's usually the entire other team :-).

Iteration was simply doing that over and over again until the end of the match.

Now, granted, your mom is probably not going to know a great deal about kiddie sports (unless you have a young child in the house) so figure out what she does know about and then write an algorithm to do it. She can even be your subject matter expert or domain expert.

Usually people who know little about computers are surprised to find out they're nothing more than glorified car engines and that invokes a certain amount of humility.

I read "4yo son" as "4mo son"
+16  A:

I think you need to separate the concepts a bit. "What is an algorithm" is best explained with the simple recipe analogy you've already used. It's not sexy, but let's be honest, neither are recipes in themselves.

"Why is what I do creative" is a completely different matter, and not really a question of algorithms specifically. Why is cooking creative? Cooking could be described as "coming up with recipes", couldn't it? (you may not write the recipes down, but they're there in the food you created. And even when you try to follow existing recipes, the result still depends on the small tweaks and adjustments you make). And what you do is "coming up with algorithms". Your job is not to implement Quicksort over and over. It is to come up with the right algorithm to use. Sometimes that may mean using an existing algorithm, such as quicksort. And sometimes it means coming up with a new one that fits your precise requirements. Similar to how a chef at a restaurant's job is not to blindly follow the same recipe over and over, but come up with the right dishes, based on what the customers want, what ingredients are available, what he served last week, and just what he feels like.

But another point is simply that you create. An architect has to respect the laws of gravity, the strength of steel and concrete and so on. No matter how much he wants to, he can't make a 4 mile high building using cheesecake as a foundation. A painter has to respect the limitations of the canvas he's painting on, and the colors he use, the structure of his brushes. And his canvas will always be two-dimensional no matter what he does. Even the best chef is limited by the ingredients at his disposal. Every other art form is limited in what they can create, by the world in which they're working.

You're not. You create everything out of a vacuum. If you want to create a "world" in which the only rules are, say, a bank's business rules, then that's what you do. If you want to create a fully interactive 3d game world, then that is what you do. And if you don't want that world to obey newtonian physics, then you simply don't implement it. If you want to create music you can do that. If you want to create a program that's able to write music for you based on the rules you set up, then that is what you do. And you can do all this using a common tool found in almost every household, costing a few hundred dollars.

Yours is the only art that has complete freedom to do whatever you like. In fact, ask your mother to name an art form that is allows more freedom and creativity than yours. Anything she can think of, you can do better. ;) Imagine what Mozart would've been able to achieve if he'd had a computer at his disposal. If he could generate any sound, and if he could simply write down the ideas, the rules he was thinking of, and then let the computer take them to their logical conclusion.

That's the creativity sorted out. Another aspect that makes programming interesting is the problem/puzzle-solving one. Of course this will mostly appeal to people who can see a certain fascination in maths. But I think most people will still be able to appreciate that "if you like solving puzzles, you'll find programming fascinating".

Going back to algorithms, use as an example one of the everyday services we now take for granted, like Google Maps being able to finding a route from A to B for us. Sure, a human can just look at the map visually, and draw an approximate route. But the computer has to treat it as a giant graph. At each intersection, it can choose several new directions. Which one should it try? How does it determine this? What if it chooses the wrong one? How can it even find out that it's taken the wrong route, until all combinations have been tried? All these possibilities add up to an insane number of combinations that must be tried before the optimal route is found. Far more than even the fastest computer can deal with. And websites do this for thousands and thousands of users concurrently. Coming up with modifications to this process to make it possible to do this in realtime should be a fascinating puzzle for anyone who has even the slightest interest in maths or combinatorics. And even if you don't, you should be able to see why it'd be fascinating to someone who does, and why it involves a whole lot of creative thinking and puzzle solving abilities.

Good explanation! Especially about the chef who has to come up with the right dishes and recipes, which is a great analogy to the programmer.
Good post - however, I think it's important to note that while computer programmers don't have the same set of physical limitations which confront architects or painters, computer programmers are constrained by the laws of logic and mathematics.
@Charles: How so? If I want to redefine "addition" to break every rule of mathematics, then I can do that.
+3  A:

The best example I saw recently was from Seth Godin of all people!

His example is bubble sort:

An algorithm is a set of instructions that allows you to solve a problem.

Each instruction is simple and repeatable. It's important to understand that the instructions work on all similar problems, not just one.

Here's an algorithm for sorting any set of numbers, to get them into order. Start with 4,3,5,6,2 for example.

The bubble sort algorithm is simple. Compare two numbers. If the first number is higher than the second, switch them. So now it's 3,4,5,6,2. Next step is to compare positions two and three. If the second is higher than the third (it's not) switch them. Repeat for the whole string. Then start over. Do it over and over again until you can go the whole way with no switching. Done.

Same trick works for alphabetizing words or sorting kids in order by height.

My suggestion would be to show your Mom how to bubblesort height using people, table condiments, books, whatever. A good hands on example can work wonders for people.

+6  A:

Start by trying not to patronise her by assuming that she's too dumb to understand such a simple thing.

Then just tell her that it's a fancy name for "a sequence of instructions for achieving a goal", and there's really not very much more to it. If you really need an analogy, the recipe idea is fine. Here's an algorithm for washing your hands:

1. Lather 2. Rinse 3. Repeat

Let's stop pretending that this is some obscure difficult technical concept. It's just jargon, and a little bit of smoke and mirrors.

You can find beauty and art in the fruits of any profession. Programming is not particularly unique in this respect. If you're making something that is appreciable as "art", or a great craft, it should be obvious from the benefit that people recieve by using it. There is a great tendency for programmers to try and compare themselves to artists. You can count me among those who would try. But I've learned that you have to prove it with the results of your work. If you just try to do it with your words you come off as a shallow pretentious wannabe. The reason that you're a programmer is you CAN see the beauty in an algorithm. If you could see the beauty in the construction of a house, maybe you would have been a carpenter or an architect.

If you wanted to be publically and widely renowned for your creativity you should have gone into a profession that is stereotypically and "obviously" creative, such as painting, or writing. Graphic design is a profession widely seen as creative, and populated by people that desperately want to be seen more like programmers: Professionals at solving specific problems in an appropriate and scholarly way. Just goes to show you the grass is always greener on the other side.

@Breton, wow.. we agree! +1
But who does the repeat step? =)
You wouldn't think it was patronizing if you knew my mom :-)
+1  A:

I would compare an algorithm to a recipe for cooking a cake. Sexist I know, but a recipe is an algorithm.

Not sexist. Look around, more women make cakes than men. Nothing sexist about that fact.
Cakes are neither male or female...how is this sexist? :-)
+1  A:

The problem with this usually is that people find it difficult to imagine something that is supposedly intelligent but is not human. Ask her for instance how would she walk a martian alien through making a telephone call. bit by bit make her realize that the alien doesn't know what a keypad is or how to interpret the sound indications given by the device. The entire volume of instructions would constitute the algorithm.

+1  A:

An algorithm is a series of steps that will always get you the result you want. It is sort of like a recipe.

An algorithm is like telling the computer 1 step at a time how to do something. The computer can do lots of stuff, but doesn't know how to decide what to do, and when, so you need a human to lay out a plan of action.

An algorithm is a PLAN OF ACTION to always get a certain expected result.

+2  A:

How to explain to your mom what an algorithm is?

An algorithm is something that was invented by Al Gore.

+1  A:

I will explain it to her when she comes over tonight!

*boom - tish*

*bows*

ha ha. you funny man/woman
+1  A:

Programming is like explaining something complicated to a really dumb child. The child is very fast at doing something but it has no eyes, no ears, it can't touch, walk, it's completely helpless. And even if it had eyes, it wouldn't understand what these strange light patterns mean.

So you have to explain very carefully and very thoroughly what it should do, one little step at a time. If you miss something or make a mistake, something is going to break.

The creative part is that once in a while, you come up with a much better way to explain. This could mean that you need less explanations, or that the explanations work for a wider range of problems. Or it could mean that you notice earlier when one of your instructions is wrong. Or you manage to teach the child to heal itself, to be more tolerant against change.

+1  A:

There are many good analogies for "algorithm" (at least one of which has been mentioned already): recipe, instructions with a sewing pattern, assembly instructions for a child's Christmas present, procedure for using a household appliance, etc. All of those approximate the notion of algorithm as a specification of definite actions taken to achieve a precisely-specified goal (not how I'd define if for most of my relatives either! ;-)

But its important to convey the difference between following an algorithm (e.g. a cook following a recipe) versus designing an algorithm (e.g. a master chef creating a new dish, and then writing it out for his/her assistants).

You might try the analogy of teaching a small child how to help with some common household task; one may need to define common terms, explain ordinary tasks, and describe "how to know when you're done".

+2  A:

Easy, my mother can do a long division so she knows an algorithm.

+1  A:

I think to explain anything complicated to anyone from outside the expertise you need to jump into a field they understand. For your Mom you might use cooking.

Recipes with step instructions are algorithms.

You bake code, she bakes cakes.

To find the beauty here in algorithms instead of following a recipe she has stepped away from the cook book and got mad with coriander to raptorous applause from the dinner table.

At my workplace I often talk about programming problems as real life problems. For instance when the boss at my company doesn't want any down time to replace a fundamental part of the system I equate that to him changing a tyre/tire on his car whilst driving down the freeway/motorway fast lane.

A:

I have a cat which needs skinning.

Thankfully it is well known that "there is more than one way to skin a cat".

Each of those ways is an algorithm applied to my problem.

The Gamekeeper's algorithm is elegant, quick, clean and efficient, but it requires much professional training.

The Looney with Unhealthy Preoccupations algorithm is as fast, requires no training, gets the job done after a fashion but doesn't leave the rest of the cat in a very useful state.

All the other algorithms fall somewhere between these two approaches.

The ideal algorithm is as easy as the looney's while being as elegant and efficient as the Gamekeeper's