Main Content
Bathtubs and pecking birds
Archive - Originally posted on "The Horse's Mouth" - 2007-06-07 08:43:14 - Graham Ellis
I have learnt of something called the "bathtub" effect in the last year or two. A complex new product has a teething period during which support requirements are high. The requirement drops away (like - into a bathtub) as the product gets more mature, but then the curve rises again as the product becomes lief expired. In other words, maintenance is lowest midlife. It happens that this was taught to me about railway trains, but I see it elsewhere too.
A program can be written in a very longwinded way. We see that especially in a language like Perl, as written by newcomers converting from C who use few of the extra facilities and end up with a huge piece of code that's hard to maintain - "can't see the wood for the trees". It's sensible to shorten the code and use some of the new facilities - into the bathtub of less support - but then the code can end up getting so short that it's obtuse. Up goes the support aspect. Look at your code and see where in the bathtub it lies!
The "pecking bird" is one of those water fed ornaments in which water drops into a container at one end of a balance. When the water holder gets full, the balance tips over and the water empties, so that the balance goes back for the next cycle. Translated into code? Let's say you want to print out 4 values per line - pour them into a Perl list using push, and have a print statement that tips them out and clears the list when there are the 4 values in there. The Pecking Bird algorithm!