19 December, 2009

Easter Eggs in Software

Easter eggs are specially decorated eggs given to celebrate the Easter holiday. These eggs are often hidden, allegedly by the Easter Bunny, for children to find on Easter morning as per Wikipedia.

Easter Eggs in software refer to hidden features in the program that are intentionally injected into the product by the programmer. These may include hidden commands, animations, funny jokes, games, credits for programmers who built the product etc. The programmers of easter eggs do it for their own personal reasons or for entertainment and are not meant to be harmful. If the programmer intentionally added malicious code to behave as a virus/spam/trojan, it may not be an easter egg. However, if the programmer added some code to behave as an easter egg that accidentally turned out to be harmful, it is still an easter egg.

How to unearth easter eggs?
Programmers Names
Search for the names of programmers who built the product. These are a very common form of easter eggs. These references mean that a few programmers wanted to take credit for the work done by them and inserted their names into the code without the knowledge of the management. More often, programmers resort to this method due to lack of appreciation for their work by the management.

Looking for swear words or expletives helps discover easter eggs. Dissatisfied/disgruntled/quitting employees may add these words in the code to take revenge on people they disliked or hated. I once saw a line reading ‘Thomas is a fool’ as part of a code snippet in one of the products that I tested a few years ago (No offense to Thomas here!).

Personalized images/animations
A few programmers embed their favorite images or animation in the code as they find themselves emotionally bound to the images/animations as much as the code that was written. For eg, a programmer might include icon images to include one of his favorite picture or a scenery.

Magical Keystrokes
A few easter eggs can be found by pressing a magical key combination/shortcut keys on the keyboard. These may be discovered accidentally or based on the knowledge of similar easter eggs in previous versions of the product.

Clusters of Easter Eggs
If an easter egg of any one type as described above was found, there is a high possibility of many more being found in close proximity to the already found egg. Pattern matching with previously found easter eggs helps find a few more surrounding them.

Read the code
Reading the code completely is one of the ways of looking for any unusual code that does not fall in line with the actual code in the product. Any code that is not in sync with the rest of the code may be easter eggs.

Ask the programmers
One of the fastest ways of finding most easter eggs is to ask the programmers themselves about what kind of easter eggs have been injected into the code. Not all programmers would reveal about all the easter eggs. A few of them might reveal theirs, but may not know about other programmers easter eggs. Some of them might be tightlipped to talk about easter eggs for fear of being fired or disciplined by the management.

Easter eggs by definition cause no harm by hiding inside the product. However, If the customers find easter eggs in the production environment, it could raise doubts about the kind of testing done on the product by the testers. The companies become liable for any offensive or illegal content that is shipped in the product and may face legal consequences. It is therefore very important to test for easter eggs as part of the normal testing process to avoid embarrassing situations after the product is shipped to the customer.

Start looking for Easter Eggs – in your software,

Happy Testing,
Parimala Shankaraiah