Where Are Those Design Patterns?

回答 大家對 Design Patterns 的必要性疑慮


我想找出 who uses the design patterns in the real world?
大家不一定會利用 Design Patterns 寫東西, 但看看你用的東西 (程式庫) 或語言 (Python) 裡, 哪些用了 Design Patterns.

  • Python 內建程式庫: itertools (有很多 iterator 範例)
  • Singleton (in Python) 
  • Logger 是一個典型的例子 (logging in Python) (日誌)
  • import 的每個 module, 也是典型的 Singleton 物件 (see in here)
  • Flyweight 每個 element, 也是一個 singleton.
  • Enum members 也是 singleton.
  • MVC Pattern (Python 沒有, Django?, Flack?, Tornado?)
  • Angular, React 等都是 MVC 類似.
  • Wrap (Decorator) in Python decorator (裝飾器)
  • Observer Pattern (RxPy = The Reactive Extensions for Python) (examples)
  • RxPy = A library for composing asynchronous and event-based programs using observable collections and query operator functions in Python