Javascript DesignPatterns