Lesson 25 / الدرس 25

Searching, and judging what you find / البحث والحكم على ما تجد

How to ask a search engine or an AI assistant the question you actually have, and how to decide whether the answer you get back is true. The second half matters more than the first.

كيف تسأل محرك بحث أو مساعدًا ذكيًا السؤال الذي لديك فعلًا، وكيف تقرر هل الجواب الذي يعود صحيح. والنصف الثاني أهم من الأول.

Search for the error, not for the feeling

bad    my php code doesn't work with database
good   SQLSTATE[23000] 1452 foreign key constraint fails

strip   your own names, ids, paths, line numbers
keep    the error class, the message, the library, the version
add     the language and the year if the answer ages badly

"exact phrase"   site:stackoverflow.com   -tutorial
The demonstration takes six real situations and shows the query most people type beside the one that finds the answer. The rewriting is mechanical once you see the pattern, and it is the difference between page four and the first result.

Judging the answer

CheckWhy
How old is it?A 2016 answer may describe an API that no longer exists
Which version is it about?The accepted answer is often for version 2 and you are on 5
Is there a newer comment below it?The best answer is frequently the second, or a comment
Does it explain, or only assert?An answer you cannot check is a coin toss
Does it match your error exactly?Similar-looking messages have unrelated causes
Did you test it in isolation?Pasting into a big project hides whether it worked

The third row is the habit that pays most on Stack Overflow: the accepted answer was accepted years ago by one person, and the answer with the recent comments is often the one that still works. Scroll.

Never paste a solution you do not understand. It is the fastest way to turn one bug into two: the visible one it appeared to fix, and the one it introduced somewhere you were not looking. The test is whether you can say, in one sentence, what the pasted code does and why that solves your problem. If you cannot, you have not solved it — you have moved it, and you will meet it again when nobody remembers where the code came from. Reading the two lines you do not recognise takes a minute; the alternative has cost people weeks.

When you have to ask a human — in an issue, a forum or a team channel — write it in four parts: what you are trying to do, what you did, what happened including the exact message, and what you already tried. Add versions and a minimal example anybody can run. This is more work than "it doesn't work, any ideas?", and it is why the well-written question gets an answer in ten minutes while the other gets three clarifying questions and then silence. It also frequently answers itself somewhere between part two and part three.

Try it live / جرّب بنفسك

Preview / المعاينة

Check yourself / اختبر نفسك

1. What should you strip out of an error message before searching for it?

2. How should you treat an AI assistant's answer about a library API?

3. Why is pasting a solution you do not understand dangerous?

Your task / مهمتك

Take five problems you have genuinely had and write the search you originally typed beside the search you would type now, with one line on what changed. Then find one answer online that is confidently wrong or out of date — check the accepted answer against the current documentation — and write down how you could tell. Ask an AI assistant a technical question whose answer you can verify, verify it, and record whether it was right and how you checked. Finally write one properly formed question in the four-part shape, for a problem you have now.

خذ خمس مشكلات واجهتك فعلًا واكتب البحث الذي كتبته أصلًا بجانب البحث الذي ستكتبه الآن، بسطر عمّا تغيّر. ثم جد على الشبكة جوابًا واثقًا وهو خاطئ أو قديم — افحص الجواب المقبول مقابل التوثيق الحالي — واكتب كيف عرفت. واسأل مساعدًا ذكيًا سؤالًا تقنيًا تستطيع التحقق من جوابه، وتحقق منه، وسجّل هل كان صحيحًا وكيف فحصت. وأخيرًا اكتب سؤالًا واحدًا مصوغًا كما ينبغي بالشكل الرباعي، لمشكلة لديك الآن.

  • Five searches, before and after, with what changed خمسة بحوث قبل وبعد مع ما تغيّر
  • One confidently wrong answer found, and how you could tell جواب واثق خاطئ ووجه معرفتك
  • An AI answer verified, with the method recorded جواب ذكاء اصطناعي متحقَّق منه بالطريقة مسجَّلة
  • One question written in the four-part shape سؤال واحد بالشكل الرباعي
How do you want to submit? / كيف تريد التسليم؟