Design pattern = giải pháp tái sử dụng cho vấn đề thiết kế phần mềm phổ biến. Phân loại 3 nhóm (GoF):
1. Creational (Tạo object)
- Factory: Tạo object không expose constructor.
- Builder: Xây object phức tạp từng bước.
- Singleton: Đảm bảo chỉ 1 instance toàn app.
- Prototype: Clone từ object mẫu.
2. Structural (Cấu trúc)
- Adapter: Chuyển interface này sang interface khác.
- Decorator: Thêm behavior động (wrapper).
- Facade: Interface đơn giản cho subsystem phức tạp.
- Proxy: Placeholder kiểm soát truy cập object thật.
3. Behavioral (Hành vi)
- Observer: Pub/Sub — subject notify observers.
- Strategy: Encapsulate algorithm, swap runtime.
- Iterator: Duyệt collection không expose cấu trúc.
- Command: Encapsulate request as object.
- State: Object thay đổi behavior khi state đổi.
JS-specific patterns: Module pattern, Revealing Module, Mixin, Middleware (Express/Redux), Hooks (React).