01Backend essentials
GO
ควบคุม lifecycle
- Context ส่ง cancellation ลงทุก dependency
- Concurrency ต้องมี limit และทางออก
- Wrap error แล้ว map ที่ boundary
- Idempotency ป้องกันคำสั่งซ้ำ
NODE
ปกป้อง Event Loop
- อย่าทำ CPU-heavy บน main thread
- Promise ต้องเลือก failure semantics
- Stream ต้องเคารพ backpressure
- ส่ง AbortSignal ลง dependency
02Frontend essentials
VUE
จัด state ให้ถูกเจ้าของ
- Computed สำหรับ derived value
- Watch สำหรับ side effect + cleanup
- State อยู่ใกล้ owner ที่สุด
- วัด performance ก่อน optimize
NEXT
วาง Boundary ให้ถูก
- Server by default, client when needed
- เลือก rendering จาก freshness
- ระวัง waterfall และ stale cache
- ไม่ส่ง secret หรือ model ทั้งก้อนไป client
03Language & data essentials
PYTHON
เลือก concurrency ให้ตรงงาน
- Async สำหรับ I/O concurrency
- Process สำหรับ CPU-heavy
- Validate ข้อมูลที่ boundary
- Profile ก่อน optimize
POSTGRESQL
Schema และ Query ต้องไปด้วยกัน
- เข้าใจ MVCC และ isolation
- EXPLAIN ก่อนเพิ่ม index
- Transaction สั้นและไม่รอ network
- Migration แบบ expand/contract
MONGODB
ออกแบบจาก Access Pattern
- Embed เมื่ออ่านและเปลี่ยนพร้อมกัน
- Reference เมื่อ relation โตไม่จำกัด
- Index ตาม query shape
- กำหนด read/write concern
REDIS
Cache ต้องพังได้
- เลือก data type ให้ตรงโจทย์
- TTL + jitter ป้องกัน stampede
- กำหนด eviction policy
- รู้ durability ของ RDB/AOF
04Messaging essentials
KAFKA
คิดเป็น Partition และ Offset
- Ordering มีแค่ใน partition
- Key กำหนด distribution
- Consumer ต้อง idempotent
- Monitor lag และ partition skew
RABBITMQ
ควบคุม Message Lifecycle
- Exchange เป็นคน route เข้า queue
- Publisher confirm + consumer ack
- Prefetch ป้องกัน consumer overload
- Retry มี backoff และ DLQ
05System Design essentials
INVARIANT
เริ่มจากสิ่งที่ห้ามผิด
- หนึ่งที่นั่งมี active owner คนเดียว
- ให้ database enforce constraint
- Cache ใช้เร่งอ่าน ไม่ใช่ตัดสิน final write
- ทุก command สำคัญมี idempotency key
FAILURE
คิดถึง Partial Failure
- Atomic update ป้องกัน concurrent booking
- Outbox ป้องกัน DB/event dual write
- Payment webhook ต้อง deduplicate
- มี reconciliation และ compensation
06สูตรตอบระดับ Senior
1หลักการ
→2ตัวอย่างจริง
→3Trade-off
→4Failure mode
→5วิธีวัดผล
ถ้าไม่รู้คำตอบทันที อย่าเดา ให้พูด assumption, แยกปัญหา, ระบุข้อมูลที่ต้องหา และบอกวิธีทดลองหรือวัดผล กระบวนการคิดที่ตรวจสอบได้สำคัญกว่าการจำ API ทุกตัว