Lather, Rinse, Repeat

A woman who was married to a computer programmer sent her husband out one day to the grocery store to buy bread.  As he was leaving she added: "If they have eggs, grab a dozen."  It will come as no surprise to the computer programmers reading this that he came back from the store with 12 loaves of bread.  In response to his wife questioning his mental state in bringing home that much bread he simply said "They had eggs."

You can't always trust a computer programmer to make great decisions.  We tend to operate the same way a computer does, which is to follow each instruction literally.  If we examine the above case we can see that the husband was given a program to run; Buy Bread.  After starting the Buy Bread program his wife altered the parameters and told him to check for eggs.  The husband did this, but because he was still running the Buy Bread program it never even occurred to him to buy eggs.  The only thing he cared about was buying was bread and his wife told him he should buy 12, provided there were eggs at the store.

If this story is confusing to you, welcome to the world of programmers.  We are forced each day to remind ourselves that the computer only does exactly what we tell it to do.  My first thought when reading the above story was that it was a good thing she told him how much bread to buy if there were eggs.  Otherwise he would still be at the store trying to figure out how much bread he needed.  Errors in computer programs are not really errors in the program, but rather incorrect instructions given by the programmer.  Computers are not allowed to make decisions about context.  They aren't capable of reading body language, or taking queues from tone or inflection.  They simply follow instructions literally.

Perhaps the best example of a computer doing exactly what it's told and having that be exactly the wrong thing to do is the Infinite Loop.  A loop is a programming tool that allows us to tell the computer to do something over and over again until a certain threshold is reached.  For example if I have a list of neighbors for whom I am baking cookies I would go through each name on the list and fill up a plate with cookies.  Once I reach the end of the list, I stop making plates of cookies.

Computer programs are only as smart as you make them.  You have to tell the computer exactly how many cookies to put on a plate.  You have to tell the computer what to do if you run out of cookies before you've gone through the whole list.  You have to tell the computer that you've reached the end of the list and to stop making plates of cookies.  If you never tell the computer what to do at the end of the list, that's an Infinite Loop.  The computer will just keep going and going until you unplug it.  You almost never want to intentionally write a program that gets stuck in an infinite loop.

Life, however is quite the opposite.  Our very existence is an infinite loop.  We make a mistake, we learn from it, then we make a brand new mistake.  Sometimes we even go back and make an old mistake again.  As we strive to be perfect we are essentially stuck in a loop.  In programming we call this an Infinite loop.  In the scriptures it's called an Eternal Round (see Doctrine and Covenants 3:2).  It's how we progress and get a little better each day.

Perhaps the best explanation of this process is given by the prophet Moroni in the Book of Mormon.  Moroni was worried about how his writing would be received by future generations, something I have a new found appreciation of, because of what he considered to be weakness on his part in writing.  The Lord provided Moroni a gentle but firm lesson in the 12th chapter of Ether:
26 And when I had said this, the Lord spake unto me [Moroni], saying: Fools mock, but they shall mourn; and my grace is sufficient for the meek, that they shall take no advantage of your weakness;
27 And if men come unto me I will show unto them their weakness.  I give unto men weakness that they may be humble; and my grace is sufficient for all men that humble themselves before me; for if they humble themselves before me, and have faith in me, then will I make weak things become strong unto them.
What a beautiful promise, and what a blessing it is to be stuck in this loop.  The whole reason we have weakness is to help us be humble and rely on the Lord.  If we take our weakness before him, he will help us turn it into strength.  Through the Atonement we have the opportunity to repent of our sins and shortcomings and the Lord will help us become strong.  But it doesn't happen in a day.  Each time we go through the repentance loop we come out better than the time before.

Infinite Loops in computer programs are almost always the result of a mistake or oversight on the part of the programmer.  The Eternal Round however is part of a perfect Program written by a perfect Programmer.
 



Comments

Popular posts from this blog

Why speaking in absolutes is ALWAYS a bad idea

The Experience of a Lifetime

Signs of the Times