Originally published by Robert Beisert at fortcollinsprogram.robert-beisert.com

Patterns for Kids: The Ant and the Grasshopper

Industriousness is difficult to describe and harder still to sell. At first blush, it might seem like it’d be easy to sell the simplest way to ensure happiness, wealth, and general success, but long-term thinking is not natural for a great many people. This is why Aesop fables are so significant – they can teach even small children the value of getting the work done early.

————————

The Ant and the Grasshopper

Once upon a time, in a pretty green field with a tall brown tree, there lived an ant and a grasshopper. It was a very nice summer in the field- the sun was shining, the grass was green, and it wasn’t too hot or too dry.

The ant spent his summer days building up his home and gathering food for the winter. He worked, and he worked, and he worked some more. Every day he would wake up and go to work, and every night he’d come in from working and go to bed.

The grasshopper had a lot of fun that summer. He would spend his days hopping around the field and playing his fiddle. He’d laugh and laugh at the hardworking ant, who didn’t even take a little time to play. It was a very fun and pleasant summer for the grasshopper.

Then the winter came,  and with it came the rains. The water would rush around the field, creating little streams and rivers that could sweep away the poor grasshopper. But the rain couldn’t get inside the ant’s house.

As the winter got colder, it would snow, and the food was hard to find. The grasshopper would sit outside and shiver, his stomach growling, while the ant was warm and happy in his snug little home.

One day, the grasshopper came to the ant and begged him for some food and shelter. “Please, Mister Ant! It’s cold out here, and I’m very hungry. Can I come in and get something to eat?”

But the ant would have to reply, “I’m sorry, Mister Grasshopper. I built this home for my family, and I only have enough food to last us through the winter. If you had only done some work this summer, when it was nice, you wouldn’t be so cold and hungry now.”

————————

The moral of this story is simple: in the long term, it’s best to work hard and build up your net worth than to play and waste your time and money. It’s fun to buy fancy things that you cannot afford, but the debt you accrue will still be there after the fancy things lose their charm. It’s fun to party in college, but if you don’t get a good degree you won’t get the kind of job that will let you pay off your student loans and build up your equity.

Politicians often provide “solutions” that sound nice in the short term (Social Security, Medicare, Affordable Housing, etc) but have devestating long-term impacts on the economy. We spend some 70% of our federal budget on wealth redistribution in some form or another, and that’s putting our country deeper in debt every year. The solutions made sense in the short term (“fun in the summer”), but in the long term they’re disastrous (“Starving in the winter”).

Programming is not that dissimilar to politics. There are hundreds of “solutions” that will work for a moment but are very difficult to maintain or upgrade. It’s easy to take the simple solution, but if you think about it the problems it will cause over time quickly outweigh the convenience of that simple solution. It’s better to sit down and think through the possibilities, then craft a (fairly complex) piece of code to address the eventualities than it is to come back several months later and try to redeem a faulty piece of code.

photo by: