Design patterns written in javascript