Nhà PV muốn nghe: một chiến lược an toàn, không "đập đi xây lại" liều lĩnh. Nguyên tắc cốt lõi: có lưới an toàn trước khi đụng dao.
Trả lời mẫu (STAR):
- Tình huống: module thanh toán cũ rối, khó thêm tính năng.
- Hành động: tôi viết test bao phủ hành vi hiện tại trước, refactor từng phần nhỏ, chạy test liên tục, và deploy theo từng bước thay vì một lần lớn.
- Kết quả: code dễ mở rộng hơn, không gây sự cố cho người dùng; team áp dụng luôn quy trình "test trước khi refactor" này.
What they're assessing: a safe strategy, not a reckless rewrite. The core principle: a safety net before you touch anything.
Sample answer (STAR):
- Situation: the old payments module was tangled and hard to extend.
- Action: I wrote tests to capture current behavior first, refactored in small pieces, ran tests continuously, and deployed incrementally rather than in one big bang.
- Result: the code became easier to extend with no user-facing incidents; the team adopted this "test before refactor" habit.