design patterns and example source code