Lesson 8 / الدرس 8
Reviewing without making an enemy / المراجعة دون صنع عدو
A review is the one place a team routinely tells somebody their work is not right yet. How that is written decides whether it improves the code, and whether the person asks you to review the next one.
المراجعة هي الموضع الوحيد الذي يخبر فيه فريقٌ أحدَهم بانتظام أن عمله ليس صحيحًا بعد. وكيفية كتابتها تقرر أتحسّن الكود، وأيطلب منك الشخص مراجعة التالي.
The same objection can be a useful comment or an insult depending entirely on how it is phrased, and the difference is small and learnable. Almost all of it comes down to reviewing the code rather than the person, and saying what will happen rather than what should have been done.
The same point, four ways
Why didn't you use a transaction here?
-- "why didn't you" asks them to defend themselves. They will.
This is wrong, it needs a transaction.
-- a verdict. Nothing to reply to except yes or an argument.
This writes the payment and the booking separately. If the process
dies between them we have money recorded against an unpaid booking.
Worth a transaction?
-- says what happens, then asks. They can agree, or explain why
it cannot happen here, and either is a good outcome.
nit: spelling of "recieve" on line 40
-- labelled small, so they know it is not blocking. Say which
of your comments are nits and which are not.
What to look for, in order
-
Does it do what the description says? Not whether it is elegant — whether the thing the ticket wanted now happens. أيفعل ما يقوله الوصف؟ لا أهو أنيق — بل أيقع الآن ما أرادته التذكرة.
-
What happens on the bad path? Empty, huge, slow, unauthorised, twice at once. This is where nearly every real finding is, and it is the reviewer's contribution more than anything about style. وماذا يحدث في المسار السيئ؟ فارغ، أو ضخم، أو بطيء، أو بلا صلاحية، أو مرتين معًا. فهنا تكاد تكون كل نتيجة حقيقية، وهي إسهام المراجع أكثر من أي شيء في الأسلوب.
-
Will somebody understand this in a year? A name that misleads, a decision with no comment behind it. The author will not be there to explain it. وأسيفهم أحد هذا بعد سنة؟ اسمٌ يضلّل، أو قرارٌ بلا تعليق خلفه. فالمؤلف لن يكون هناك ليشرحه.
-
Style, last and briefly. If your team has a formatter, style is not a review topic at all — and if it is not automated, that is the thing worth fixing rather than the file in front of you. والأسلوب، أخيرًا وباختصار. فإن كان لفريقك منسّق، فالأسلوب ليس موضوع مراجعة أصلًا — وإن لم يكن مؤتمتًا، فذلك ما يستحق الإصلاح لا الملف الذي أمامك.
Try it live / جرّب بنفسك
Check yourself / اختبر نفسك
1. What can "this writes them separately; if the process dies we have money against an unpaid booking" be answered with, that "this is wrong" cannot?
Saying what will happen, then asking, leaves room for the author to be right. A verdict can only be answered with compliance or a fight.
2. Where are nearly all real review findings?
It is also the reviewer's largest contribution. Style, if the team has a formatter, is not a review topic at all.
3. You would have written it differently, but it works and is clear. What is that?
They stop reading your comments for content and start reading them for tone. If it is fine, say it is fine.
Score / النتيجة: 0 / 3
Your task / مهمتك
Find a real review comment — one you received, one you wrote, or one from any public pull request. Write it as it was, say what it asks the author to do, then rewrite it so that it says what will happen and can be answered with information.
جد تعليق مراجعة حقيقيًا — تلقيته، أو كتبته، أو من أي طلب سحب عام. اكتبه كما كان، وقل ماذا يطلب من المؤلف، ثم أعد كتابته بحيث يقول ما سيحدث ويمكن إجابته بمعلومة.
- The comment as it was actually written التعليق كما كُتب فعلًا
- What it asks the author to do — defend, comply, or think ماذا يطلب من المؤلف — أن يدافع أو يمتثل أو يفكر
- A rewrite that states the consequence and can be answered with information إعادة كتابة تذكر العاقبة ويمكن إجابتها بمعلومة