📱 Học IELTS miễn phí: App IELTS 6.0

Giới thiệu

Code Review là một phần không thể thiếu trong quy trình phát triển phần mềm. Khi làm việc trong môi trường quốc tế, bạn cần biết cách đặt câu hỏi, góp ý, và phản hồi review bằng tiếng Anh một cách lịch sự và chuyên nghiệp.

Bài viết này tổng hợp 30 câu hỏi & trả lời thường gặp nhất trong Code Review, chia theo tình huống cụ thể.


1. Bảng từ vựng Code Review

Từ/Cụm từPhát âm IPANghĩa tiếng Việt
code review/koʊd rɪˈvjuː/đánh giá/xem lại code
pull request (PR)/pʊl rɪˈkwest/yêu cầu merge code
reviewer/rɪˈvjuː.ər/người review
approve/əˈpruːv/chấp thuận
request changes/rɪˈkwest ˈtʃeɪn.dʒɪz/yêu cầu sửa đổi
nit (nitpick)/nɪt/góp ý nhỏ, không quan trọng
refactor/riːˈfæk.tər/tái cấu trúc code
edge case/edʒ keɪs/trường hợp biên
regression/rɪˈɡreʃ.ən/lỗi phát sinh do thay đổi
trade-off/ˈtreɪd.ɒf/sự đánh đổi
hardcoded/ˈhɑːrd.koʊ.dɪd/viết cứng trong code
naming convention/ˈneɪ.mɪŋ kənˈven.ʃən/quy ước đặt tên
boilerplate/ˈbɔɪ.lər.pleɪt/code mẫu lặp lại
code smell/koʊd smel/dấu hiệu code xấu
LGTM/ˌel.dʒiː.tiːˈem/Looks Good To Me — OK rồi

2. Câu hỏi khi Review code người khác

Hỏi về logic & thiết kế

#Tiếng AnhTiếng Việt
1Could you explain the reasoning behind this approach?Bạn có thể giải thích lý do chọn cách làm này không?
2What happens if user is null here?Điều gì xảy ra nếu user là null ở đây?
3Have you considered using a strategy pattern instead?Bạn đã cân nhắc dùng strategy pattern chưa?
4Is there a specific reason you chose this library over X?Có lý do cụ thể nào bạn chọn thư viện này thay vì X không?
5How does this handle concurrent requests?Cái này xử lý concurrent requests như thế nào?

Hỏi về performance & security

#Tiếng AnhTiếng Việt
6Could this query cause a performance issue with large datasets?Query này có thể gây vấn đề hiệu suất với dataset lớn không?
7Is this input sanitized before being used in the query?Input này được sanitize trước khi dùng trong query chưa?
8Should we add an index on this column?Có nên thêm index cho cột này không?
9Is there a rate limit on this endpoint?Endpoint này có rate limit chưa?
10What’s the time complexity of this algorithm?Độ phức tạp thời gian của thuật toán này là gì?

Hỏi về testing & edge cases

#Tiếng AnhTiếng Việt
11Are there unit tests covering this change?Có unit test cover thay đổi này chưa?
12What happens when the input is empty?Điều gì xảy ra khi input rỗng?
13Have you tested this with edge cases like negative numbers?Bạn đã test với edge case như số âm chưa?
14Could this break any existing functionality?Cái này có thể làm hỏng chức năng hiện có không?
15Did you run the integration tests locally?Bạn đã chạy integration tests ở local chưa?

3. Cách đưa ra góp ý (Review Comments)

Góp ý lịch sự (Suggestions)

#Tiếng AnhTiếng Việt
16Nit: Consider renaming this variable to something more descriptive.Góp ý nhỏ: Nên đổi tên biến này thành tên mô tả hơn.
17Optional: We could simplify this with a ternary operator.Tùy chọn: Có thể đơn giản hóa bằng toán tử 3 ngôi.
18Suggestion: It might be cleaner to extract this into a helper function.Gợi ý: Có thể sạch hơn nếu tách thành helper function.
19This could be replaced with Array.map() for readability.Cái này có thể thay bằng Array.map() cho dễ đọc hơn.
20Minor: Missing a trailing comma here — it’ll help with cleaner diffs.Nhỏ: Thiếu dấu phẩy cuối — sẽ giúp diff sạch hơn.

Góp ý quan trọng (Must fix)

#Tiếng AnhTiếng Việt
21This will cause a memory leak — we need to clean up the listener.Cái này sẽ gây memory leak — cần dọn dẹp listener.
22This is a potential SQL injection vulnerability. Please use parameterized queries.Đây là lỗ hổng SQL injection tiềm tàng. Hãy dùng parameterized queries.
23This breaks backward compatibility — existing clients will fail.Cái này phá vỡ backward compatibility — client hiện tại sẽ lỗi.
24We need to add error handling here — this will crash if the API is down.Cần thêm error handling ở đây — sẽ crash nếu API bị down.
25This hardcoded value should be moved to the config/environment variable.Giá trị hardcode này nên chuyển vào config/biến môi trường.

4. Cách trả lời Review Comments

Đồng ý và sẽ sửa

#Tiếng AnhTiếng Việt
26Good catch! Fixed in the latest commit.Phát hiện hay! Đã sửa trong commit mới nhất.
27Makes sense. Updated — please take another look.Hợp lý. Đã cập nhật — anh/chị xem lại giúp nhé.
28You’re right, I missed that edge case. Added a check now.Đúng rồi, tôi bỏ sót edge case đó. Đã thêm check.

Giải thích lý do giữ nguyên

#Tiếng AnhTiếng Việt
29I intentionally kept it this way because [reason]. Let me know if you still think we should change it.Tôi cố ý giữ thế này vì [lý do]. Cho tôi biết nếu vẫn nên đổi.
30I considered that, but the trade-off is [explanation]. Happy to discuss further!Tôi đã cân nhắc, nhưng sự đánh đổi là [giải thích]. Sẵn sàng thảo luận thêm!

5. Ví dụ Code Review thực tế

Tình huống: Review một PR thêm chức năng tìm kiếm

Reviewer comment:

Line 45: Could you explain why you’re using setTimeout here? It seems like we could use debounce from lodash instead, which would be more robust.

Also, what happens if the user types faster than 300ms? I think the current implementation might fire multiple API calls.

Author reply:

Good point! I was initially trying to keep it simple without adding a new dependency, but you’re right — lodash.debounce handles edge cases better (like the rapid typing scenario).

Updated in commit a1b2c3d. I also added a cancel on unmount to prevent memory leaks. PTAL (Please Take Another Look)!

Tình huống: Góp ý nhỏ về naming

Reviewer:

Nit: data is pretty generic. How about renaming to userProfiles to make the intent clearer?

Author:

Agreed — renamed in the latest push. 👍


6. Viết tắt phổ biến trong Code Review

Viết tắtĐầy đủNghĩa
LGTMLooks Good To MeOK, chấp thuận
PTALPlease Take Another LookXem lại giúp nhé
WIPWork In ProgressĐang làm dở
AFAIKAs Far As I KnowTheo tôi biết
IMOIn My OpinionTheo ý tôi
TL;DRToo Long; Didn’t ReadTóm tắt
FYIFor Your InformationĐể bạn biết
ACKAcknowledgedĐã nhận, đã biết
nitNitpickGóp ý nhỏ không quan trọng
WDYTWhat Do You Think?Bạn nghĩ sao?

7. Tips giao tiếp trong Code Review

Cho Reviewer:

  1. Dùng câu hỏi thay vì mệnh lệnh — “Could we consider…?” thay vì “Change this.”
  2. Phân biệt mức độ — Đánh dấu nit:, minor:, blocking: để author biết ưu tiên
  3. Khen trước góp ý — “Nice approach! One small suggestion…”
  4. Giải thích lý do — “This might cause X because Y” thay vì “This is wrong”

Cho Author:

  1. Đừng take it personally — Review là review code, không phải review bạn
  2. Cảm ơn reviewer — Họ bỏ thời gian đọc code của bạn
  3. Giải thích context khi disagree — Đừng chỉ nói “No”
  4. Update sớm — Đừng để PR treo quá lâu

8. Bài tập thực hành

Exercise 1: Viết review comment

Bạn thấy đoạn code sau trong PR. Hãy viết review comment bằng tiếng Anh:

1
2
3
4
function getUser(id) {
  const data = db.query("SELECT * FROM users WHERE id = " + id);
  return data;
}

Gợi ý: Có vấn đề về security và naming.

📝 Đáp án gợi ý

Blocking: This is vulnerable to SQL injection. Please use parameterized queries instead:

1
const data = db.query("SELECT * FROM users WHERE id = ?", [id]);

Nit: Consider renaming data to user since we’re fetching a single record.

Exercise 2: Trả lời review comment

Reviewer nói: “This function is doing too much. Could we split it into smaller functions?”

Viết câu trả lời đồng ý và cho biết bạn sẽ refactor.

📝 Đáp án gợi ý

“You’re right, it’s getting a bit long. I’ve refactored it into three smaller functions: validateInput(), processData(), and formatResponse(). Each one has a single responsibility now. Updated in the latest commit — PTAL!”


Tổng kết

Code Review không chỉ là đọc code — đó là giao tiếp. Cách bạn đặt câu hỏi, góp ý, và phản hồi phản ánh sự chuyên nghiệp của bạn.

3 nguyên tắc vàng:

  • 🤝 Lịch sự — Góp ý code, không phán xét người
  • 💡 Cụ thể — Nêu rõ vấn đề và đề xuất giải pháp
  • Kịp thời — Review và phản hồi nhanh

Chúc bạn tự tin hơn trong mỗi lần Code Review! 🚀