Garbage in, Garbage Out — the secret of successful cooking

A fundamental precept of programming is “Garbage in, garbage out”. It means that a program that is fed garbage input can only produce garbage output. It can’t work miracles.

It’s interesting that most introductory books on programming describe a program as a recipe for solving a problem, for turning input into output. Think about a program that has to try to extract information from text. If the input is garbage — poorly formatted, misspellings — then the program will have to be exceedingly complex. If the text is well-formed and structured, the program can be incredibly simple. A simple script or parser will often suffice.

Now turn the metaphor around and think of a recipe as a program for turning raw ingredients into an edible dish. When your inputs are fresh, high-quality ingredients, you can cook the simplest dishes with a minimum of time and effort and they will taste amazing. If, however, your input ( raw ingredients ) is garbage, then your output ( final dish ) will be garbage as well.

When you start with high-quality, fresh ingredients, turning them into something delicious is pretty simple. For example: A steak. A pork chop. A nice piece of salmon or tuna. All of these things can be prepared by putting a pan on the stove, setting it to medium-high heat, and cooking for a few minutes on each side. You can get more complicated if you want, but start simple.

Obviously, just as a bad program can still make a mess of perfect data, a bad cook can make a mess of good ingredients. Good ingredients do not guarantee success. But they make it much more likely.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>