Section 6: Abstract Class และ Interface
- Abstract Class ต่างจาก Class ทั่วไปอย่างไร
- Interface พร้อม default, static และ private Method
- เลือกระหว่าง Abstract Class กับ Interface
- Functional Interface และ Lambda ในมุมของ OOP
- Lab: ออกแบบ Interface ช่องทางแจ้งเตือนหลายแบบ
Section 7: Lab: Record, Sealed Class และ Pattern Matching
- Record สำหรับข้อมูลที่ไม่เปลี่ยนค่า และ Compact Constructor
- Sealed Class และ Sealed Interface จำกัดชนิดลูกที่อนุญาต
- Pattern Matching กับ instanceof และ switch
- Record Pattern และ Unnamed Pattern
- Lab: โมเดลการชำระเงินหลายรูปแบบด้วย Sealed Interface และ switch
Section 8: Composition แทน Inheritance
- ความสัมพันธ์แบบ has-a, Association และ Aggregation
- Delegation และเหตุผลที่ควรเลือก Composition ก่อน
- Enum ที่มีพฤติกรรมของตัวเอง
- Lab: Refactor ลำดับชั้นที่ซับซ้อนให้เป็น Composition
Section 9: Generics และ Collections ในการออกแบบ
- Generic Class และ Generic Method
- Bounded Type และ Wildcard
- Comparable กับ Comparator สำหรับเรียงลำดับ Object
- เลือก List, Set หรือ Map ให้เหมาะกับโมเดลข้อมูล
- Lab: Repository แบบ Generic สำหรับข้อมูลในระบบห้องสมุด
Section 10: Lab: ออกแบบ Exception ให้เป็นระบบ
- Checked กับ Unchecked Exception และเมื่อใดใช้แบบไหน
- สร้าง Custom Exception ที่สื่อความหมายทางธุรกิจ
- try-with-resources และการไม่กลืน Error
- ใช้ Optional แทนการคืนค่า null
- Lab: จัดการกรณียืมหนังสือเกินสิทธิ์และหนังสือไม่ว่าง