some cool patterns with scala