Showing posts with label parenting. Show all posts
Showing posts with label parenting. Show all posts

Wednesday, 23 October 2013

Programming fault-tolerant babies

One of the things that many new parents share with new programmers is a lack of experience with how their charges (babies or software) should best adapt to the world around them. When I became a father for the first time, one crucial goal was to ensure that my new son was getting enough sleep. So that meant making sure that his room was quiet and that people tiptoed around and spoke quietly when he was sleeping.

New programmers are often given tasks such as writing a program to read a list of numbers and calculate their average. So the programmer creates a list of ten numbers which he uses to test his program. After a while, he has a program that works perfectly. He even tries a list of five numbers and a list of twenty numbers and it continues to work perfectly.

However as soon as he releases the program into the public domain, he receives reports that it isn't working. Confused, he investigates the reports and finds out that people have lists that contain letters as well as numbers. Or they are using commas instead of spaces to separate the numbers. Or the list is empty and the program crashes with a divide-by-zero error. Or the list can't be found. The naïve programmer's first response is to tell the users that they're doing it wrong. The program expects a list of numbers so give it a list of numbers! Sheesh.

The more experienced programmer realizes that programs shouldn't crash and burn just because they can't handle the input correctly. They should give advice to the user to help them provide appropriate input and be nice about it.

Similarly with parenting young children. It is sometimes possible to create a perfectly quiet environment when you have only one child. Though it can still require a lot of effort by the parents to keep it that way. But what happens when you have visitors, or have more kids, or have noisy cars in the street? At some point it becomes easier for everyone if the baby can sleep despite the background noise or the ambient light and feed happily despite the odd location or the precise milk temperature.

Although having siblings banging loudly on the baby's door might still be input that it is better to try to prevent!