Design pattern คือแนวทางแก้ปัญหาที่นำกลับมาใช้ซ้ำได้และได้รับการพิสูจน์แล้วสำหรับปัญหาการออกแบบซอฟต์แวร์ที่พบบ่อย เป็นเทมเพลตทั่วไปสำหรับวิธีการจัดโครงสร้างโค้ดเพื่อแก้ความท้าทายที่เกิดขึ้นซ้ำ ๆ มันให้คำศัพท์ร่วมกันและแนวทางที่ผ่านการทดสอบมาแล้ว ช่วยให้เขียนโค้ดได้ดีขึ้นและดูแลรักษาได้ง่ายขึ้น
Design pattern คืออะไร
DESIGN PATTERNS = proven, reusable solutions to RECURRING design problems:
→ not code to copy, but TEMPLATES/approaches for structuring code
→ distilled from experience (best practices for common situations)
→ e.g. "how do I ensure only one instance of a class?" → Singleton pattern
→ describe the PROBLEM, the SOLUTION structure, and the trade-offs
