Design Patterns Javascript