views:

168

answers:

2

A pearl is an elegant, instructive and fun example of programming, which teaches important techniques and fundamental design principles.

For example, I really enjoyed the programming pearl Automata via Macros. It shows how to build a construct for finite state machines using Scheme macros, while touching upon the importance of tail-call optimization.

So, what's your favorite programming pearl?

+2  A: 

Data-Directed Programming. Once I wrapped my mind around the idea of looking up behavior in a data structure and then executing it, I discovered that many thorny problems can be resolved with very small amounts of code using this technique. Rob Pike also mentions this in the "Function pointers" section of his Notes on Programming in C.

Glomek
A: 

Project Euler.

A number of people have started this: here's one for Scala, and Randall Munroe for Python.

Or, you could do as my CS prof does - in each new language he learns he implements a Genetic Algorithm.

jamesh