design patterns snippets