Design Patterns used in the jQuery library

后端 未结 4 2001
臣服心动
臣服心动 2020-12-07 07:10

jQuery is highly focused on the DOM and provides a nice abstraction around it. In doing so, it makes use of various well known design patterns which just hit me yesterday. O

4条回答
  •  难免孤独
    2020-12-07 07:42

    How about the Singleton/Module pattern, as discussed in this article about YUI: http://yuiblog.com/blog/2007/06/12/module-pattern/

    I believe jQuery uses this pattern in its core, as well as encouraging plug-in developers to use the pattern. Using this pattern is a handy and efficient way of keeping the global namespace clear of clutter, which is further useful by assisting developers in writing clean, encapsulated code.

提交回复
热议问题