נבנה על ידיBuilt by Ariel Yohimovich

חזרה למפגשBack
PythonPython

עבודה נכונה עם עוזר AI לקודWorking well with an AI coding assistant

מפגש 32: מתי לסמוך, איך לבדוק, איך לבקש, ואיך לא לאבד את ההבנה.Session 32: When to trust it, how to verify, how to ask, and how not to lose understanding.

מה נעשה היוםToday's plan

  • תפקידRole
  • בקשהPrompting
  • סקירהReview
  • בדיקותTests
  • המצאותHallucinations
  • אבטחהSecurity
נושאTopic 1

תפקידRole

מה עוזר AI טוב בוWhat an AI assistant is good at

  • מצוין: טיוטה, הסבר, רעיונות, קוד חוזרGreat at: drafts, explanations, ideas, boilerplate
  • חלש: אחריות, הקשר שלא נתתם, עובדות עדכניותWeak at: responsibility, context you didn't give, current facts
  • אתם עדיין המתכנתיםYou're still the programmer

אנלוגיהAnalogy

עוזר AI הוא כמו מתמחה מוכשר מאוד ביום הראשון: עובד מהר ויודע המון, אבל לא מכיר את המשרד, ואתם חותמים על מה שיוצא.An AI assistant is like a very talented intern on day one: works fast and knows a lot, but doesn't know the office, and you sign off on what goes out.
נושאTopic 2

בקשהPrompting

לבקש טובAsking well

  • הקשר: מה הפרויקט, איזו גרסהContext: what the project is, which version
  • דוגמת קלט ופלטAn input and output example
  • אילוצים: בלי ספריות, טיפוסים, מקרי קצהConstraints: no libraries, types, edge cases

אנלוגיהAnalogy

בקשה מעורפלת לעוזר היא כמו לבקש מנהג מונית "לנסוע למרכז": הוא ייסע, אבל כנראה לא למקום שרציתם.A vague request to an assistant is like telling a taxi driver "drive to the centre": they'll drive, just probably not where you meant.
נושאTopic 3

סקירהReview

לקרוא לפני שמקבליםRead before you accept

  • סקירה: האם אני מבין כל שורה?Review: do I understand every line?
  • מריצים על מקרי קצהRun it on edge cases
  • מבקשים הסבר על מה שלא ברורAsk for an explanation of what's unclear

אנלוגיהAnalogy

סקירת קוד היא כמו לקרוא חוזה לפני שחותמים: גם אם עורך דין מעולה ניסח אותו, השם שלכם עליו.Code review is like reading a contract before signing: even if a great lawyer drafted it, it's your name on it.
נושאTopic 4

בדיקותTests

בדיקות קודם, קוד אחר כךTests first, code second

  • כותבים מפרט כבדיקותWrite the spec as tests
  • נותנים לעוזר את הבדיקותGive the assistant the tests
  • הבדיקות מחליטות, לא תחושת בטןTests decide, not gut feeling

אנלוגיהAnalogy

בדיקות הן כמו שבלונה למכונית חדשה: לא משנה מי ייצר את החלק, אם הוא לא נכנס בשבלונה, הוא לא נכנס לרכב.Tests are like a template on an assembly line: whoever made the part, if it doesn't fit the template, it doesn't go in the car.
נושאTopic 5

המצאותHallucinations

המצאותHallucinations

אנלוגיהAnalogy

המצאה של מודל היא כמו נווט שבטוח שיש פנייה ימינה: לפעמים הוא צודק, אבל כדאי להסתכל על השלט לפני שמסובבים את ההגה.A model's hallucination is like a navigator certain there's a right turn: sometimes right, but look at the sign before turning the wheel.

טעות נפוצהCommon mistake

check_claims.py
shelf = ["Dune", "Emma"]
shelf.remove_all("Dune")
מה Python עונהWhat Python says
AttributeError: 'list' object has no attribute 'remove_all'
AttributeError: 'list' object has no attribute 'remove_all': אין כזו. לרשימה יש remove (מופע ראשון). dir(list) מראה את כל מה שקיים.AttributeError: 'list' object has no attribute 'remove_all': there's no such thing. Lists have remove (first occurrence). dir(list) shows everything that exists.
נושאTopic 6

אבטחהSecurity

פרטיות ואבטחהPrivacy and security

  • לא מדביקים סיסמאות, מפתחות ומידע אישיDon't paste passwords, keys or personal data
  • לא מריצים פקודות שלא מביניםDon't run commands you don't understand
  • קוד שנוצר יכול להכיל פרצותGenerated code can contain holes

אנלוגיהAnalogy

להדביק מפתח API לצ'אט זה כמו לצעוק את הקוד של הכספת באמצע רחוב: גם אם אף אחד לא שמע, עדיף להחליף אותו.Pasting an API key into a chat is like shouting the safe's code in the street: even if nobody heard, better change it.

מצוין: טיוטה, הסבר, רעיונות, קוד חוזרGreat at: drafts, explanations, ideas, boilerplate

חלש: אחריות, הקשר שלא נתתם, עובדות עדכניותWeak at: responsibility, context you didn't give, current facts

אתם עדיין המתכנתיםYou're still the programmer

הקשר: מה הפרויקט, איזו גרסהContext: what the project is, which version

דוגמת קלט ופלטAn input and output example

אילוצים: בלי ספריות, טיפוסים, מקרי קצהConstraints: no libraries, types, edge cases

סקירה: האם אני מבין כל שורה?Review: do I understand every line?

מריצים על מקרי קצהRun it on edge cases

מבקשים הסבר על מה שלא ברורAsk for an explanation of what's unclear

כותבים מפרט כבדיקותWrite the spec as tests

נותנים לעוזר את הבדיקותGive the assistant the tests

הבדיקות מחליטות, לא תחושת בטןTests decide, not gut feeling

פונקציות וחבילות מומצאותMade-up functions and packages

בודקים בתיעוד הרשמיCheck the official docs

מריצים לפני שמאמיניםRun before you believe

לא מדביקים סיסמאות, מפתחות ומידע אישיDon't paste passwords, keys or personal data

לא מריצים פקודות שלא מביניםDon't run commands you don't understand

מה למדנוWhat we learned

  • מצוין: טיוטה, הסבר, רעיונות, קוד חוזרGreat at: drafts, explanations, ideas, boilerplate
  • הקשר: מה הפרויקט, איזו גרסהContext: what the project is, which version
  • סקירה: האם אני מבין כל שורה?Review: do I understand every line?
  • כותבים מפרט כבדיקותWrite the spec as tests
  • פונקציות וחבילות מומצאותMade-up functions and packages
  • לא מדביקים סיסמאות, מפתחות ומידע אישיDon't paste passwords, keys or personal data

עכשיו לתרגולNow, practice

5 תרגילים ו-2 אתגרים, עם בדיקה אוטומטית5 exercises and 2 challenges, auto-checked
הערות מרצהSpeaker notes

נבנה על ידיBuilt by Ariel Yohimovich