views:

659

answers:

16

I was recently put on the spot and I had to explain what "code" was. It was an older gentleman who really didn't know, and really didn't care, about computer science.

I tried my best to dumb it down and explain it like this:

"Code is instructions you write to the computer. The computer interprets the code and does something with it (in this case it makes a website). You write code like you're writing a document -- it's just text. The code is written in a specific syntax so the computer knows what you are trying to say."

What would you have said? How would you try to answer the question:

"What is code?"

To someone with little knowledge of computers and internets, much less programming?

+15  A: 

Programming is like creating a food recipe.

You figure out the ingredients, the quantities, the process/steps for making the recipe.

The cook that will "do" the recipe will be the computer; it just follows the recipe.

Max
I find the recipe analogy very useful, as it can be easily be extended to explain more complex topics such as the benefits of open source, or abstraction (I don't know how to make mayonnaise, but I can reuse that recipe in another, hiding part of the process that I do not need to redevelop).
Liam
public class Mornay extends Bechamel
Adam Jaskiewicz
A: 

Code is instructions you give to machines which can only perform very simple tasks by themselves, like adding to numbers. By giving the correct code, you can get those machines to perform much more difficult tasks.

Ulf
+1  A: 

You can explain as following.

  1. It is same as conversation between two human beings i.e., if I call someone by saying "Come Here" then he comes to me. Same way code is a type of conversation between us and computer.

  2. As human beings can understand only in his known languages, same way computer can understand only in particular language i.e., binary code.

Vinay
I like the language analogy to programming. It's common point of reference for anyone in the world. We all speak some sort of language.
Jared
Binary code is not a language, its letters in an alphabet. There are many different meanings (languages) that can be expressed using binary.
Pyrolistical
I'd steer away from using language as an analogy. Although programming languages are described as "languages" they're really more like a mathematical notation or sequence of instructions.
Simon Howard
+2  A: 

Code is like a recipe for your favorite cake. Someone, a chef = programmer, wrote out the logical steps (statements) with the required ingredients (function calls) which when followed produce the cake (program).

Then others can enjoy the cake (program, ie. get cash from the ATM, use the Interactive TV Guide to find his re-runs of MASH, punch 2 mins into his microwave to let him reheat the soup his Daughter dropped off this morning).

That is what code is.

Mark Thistle
A: 

I would explain Programming to a layman as "Giving a computer a set of instructions and allowing it to robotically follow those instructions to the letter without the need for my further interference. That information would include what to do if different conditions are encountered."

I would explain Code as those specific instructions in the language that a Computer can understand.

I think even those people who do not understand computer science are familiar with Robots and that is the best analogy you can give them.

Cerebrus
+3  A: 

Programming languages are Like Lego bricks. There are different kinds of sets like Duplos, Technic and Clasic, same thing with programing languages there are many flavors that can do many different things depending on how advanced you want to get. but all in all in the end you build something cool and its fun getting there so long as you have good blueprints or creativity.

Ioxp
I'd upvote you but I have a pathological hatred of the phrase "Legos" :P
annakata
Thank you for the up vote. I understand that in formal training and books they use this analogy a lot, but those little blocks are probably the root cause of my love of programming and problem solving to date.
Ioxp
I think you've misunderstood. annakata was referring to the phrase "legos", which is incorrect. "Lego bricks" is the correct term.
Simon Howard
Oh, the text has been updated it doesn't matter to me either way there still fun to play with and it makes for a good analogy.
Ioxp
+1  A: 

The way I like to explain coding (or any other complex question) is to use something that is seen and known about in everyday life. A good example would be a traffic light.

Everything that the Traffic Lights do are governed by parameters (like traffic laws) and code which makes them change, how often they change, if they go to blinking red/yellow at certain times of day/night, etc.

Traffic lights use code to tell them when to change from Green to Yellow to Red. The code tells Signal 1 how long to stay Red and to make sure that Signal 2 is Red before Signal 1 changes to Green.

Just my $0.02!

JFV

JFV
A: 

Think of a recipe to make a cake. Some master-chef has created the recipe for you. In computer science, we call this person a "programmer". The recipe comes in the form of a program which is in fact the recipe converted into a form which is more simple for the computer to understand. We call the human readable form of the recipe (i.e. the form before it was converted for the computer) "code".

Aaron Digulla
A: 

Programming is creating, arranging and connecting the dots to make a computer do something you want.

Jas Panesar
So when I use a mouse, I am programming!
Pyrolistical
Haha, of course!
Jas Panesar
+2  A: 

coding is like instructing an super obedient super moron.

Vardhan Varma
+3  A: 

I would say the best way to explain it is to just be straightforward with it and not try to fudge an analogy into your explanation.

"Code is the set of instructions that tell a computer what to do." does the trick for me!

C.McAtackney
But when I opened notepad and wrote down what I wanted the computer to do, it didn't listen!
Pyrolistical
A: 

A lot of the posted analogies are good, but I always like to add this important piece of information that non programmers need to understand if you want to convey programming to them:

The computer will do EXACTLY what you tell it to do.

Not what you meant it to do Nothing that you didnt tell it to do (it will not infer any details or intermediate steps or even prerequisites of some steps) It will have no idea of your intent, it only follows your exact instructions.

Neil N
A: 

Everything that happens on your computer comes from code, which are the instructions to tell the computer what to do.

Nothing happens without code. Without code your computer just sits there and won't even turn on.

Alex Baranosky
A: 

A computer is a a stupid machine that just stores symbols (better known as data). In order to do anything useful, it needs a full set of precise instructions for each and every little thing that needs to be done. The computer diligently follows the instructions even if they don't make sense or are destructive, so care needs to be taken in assembling them. Since they are so precise, many of these 'programs' require a huge number of instructions to work properly.

Most people use computers to assemble ever increasing piles of data. Gradually over the years, the size and complexity of these data piles has significantly increased into a massive scale.

Programming is the act of sitting in front of a computer, trying to find ways of avoiding typing in all of the necessary instructions and/or all of the data.

Paul.

Paul W Homer
+1  A: 

Code is the music, the computer is the piano.

SomeMiscGuy
What is the Pianist?
Kyle Trauberman
why that would be the programmer. Writing code is very similar (IMHO) to writing music.
SomeMiscGuy
So the programmer reads the code and makes the computer follow it?
Michael Myers
Code doesn't exist before it is written in the same way that music doesn't exist before it is played. The computer or the piano only accepts what it is given and if the input is good, the result is.
SomeMiscGuy