Before the Ajax appears, JavaScript is rarely utilized in
the traditional Web applications, and under most circumstances developers have
to face up to procedure-oriented programming. So, real advanced JavaScript
developers are also rare. But nowadays, with the share of the rich client Web
applications becoming larger and larger, the role of JavaScript is becoming
more and more outstanding and important. How to the reuse the existing JavaScript
code and deal with the changing of requirements becomes the urgent problem that
every JavaScript developer has to take into account. The popular design
patterns put forward by GoF (Erich Gamma, Richard Helm, Ralph Johnson, and John
M. Vlissides) are welcomed by developers all over the world. As for the
JavaScript field, these design patterns applies in the similar way. In this
article I will show you how to apply the six popular design patterns from GoF
to the JavaScript programming area by related samples.
Now, let us delve into these interesting patterns one-by-one.