انتقل إلى المحتوى
أمين أبوزيد
MID-072

الهندسة بمساعدة الذكاء الاصطناعي على مستوى قاعدة الشيفرة

  • 6 درس
  • 2.5 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • تصحيح الأخطاء بمساعدة الذكاء الاصطناعي
  • إعادة الهيكلة (refactoring)
  • وتوليد الاختبارات في قواعد الشيفرة الكبيرة
  • انضباط المراجعة
  • قياس الجودة

تعلّم أولًا

2.5 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Give an AI assistant the right context on a large codebase (relevant files, tests, conventions, failing output) instead of whole repositories.
  2. Use AI to form debugging hypotheses from stack traces, logs, and profiles, and confirm them with evidence before changing code.
  3. Refactor with AI in small steps under a green test suite, rejecting changes that alter behavior.
  4. Generate tests that add value (edge cases, regression tests) and discard tests that merely restate the implementation.
  5. Measure the effect of AI assistance on review time, defect rate, and test quality rather than lines produced.

الدروس

  1. 01مساعدو الذكاء الاصطناعي في قواعد الشيفرة الكبيرة
  2. 02تصحيح الأخطاء بمساعدة الذكاء الاصطناعي بالاعتماد على الأدلة
  3. 03إعادة الهيكلة بالذكاء الاصطناعي في ظل شبكة أمان
  4. 04توليد اختبارات تستحق الاحتفاظ بها
  5. 05انضباط المراجعة وقياس الجودة
  6. 06عرض عملي: إعادة هيكلة order saga بمساعدة الذكاء الاصطناعي مع بقاء الاختبارات خضراء

المختبر والتمارين

Lab

MID-072-LAB1 · AI-assisted refactor

Outcomes: 1–5 · Time: ~2.5 h

  1. Pick one Shop Platform service module; give an AI assistant a focused context (files, tests, conventions).
  2. Refactor in small steps under a green suite; commit each step.
  3. Add regression tests for a past incident; run mutation testing on the new tests.
  4. Submit a pull request with a prompt log, accepted and rejected suggestions, and mutation results.

Acceptance: behavior unchanged (all tests and contracts green); reviewer can trace every AI-originated change.

Exercises (assessment: review an AI-generated pull request; five exercises)

IDOutcomeTask
MID-072-EX011Write a prompt to add a feature to inventory: goal, files, constraints, existing pattern, failing test; redact anything sensitive from a sample log.
MID-072-EX022From a stack trace with a LazyInitializationException-style error, list three hypotheses and the evidence that would confirm each.
MID-072-EX033Plan a refactor of a 300-line method into five small steps, each with a verification.
MID-072-EX044Review five AI-generated tests; keep, change, or discard each with a reason.
MID-072-EX055Define three metrics to judge an AI rollout in your team and how you would collect them.
أظهر الحلول
  • EX01 Context limited to the relevant files and the pattern to follow; constraints stated; secrets and personal data replaced with synthetic values.
  • EX02 Hypotheses such as access outside a transaction, a changed fetch mode, or a recent refactor; confirm by reproducing, inspecting the transaction boundary, and checking recent diffs.
  • EX03 Characterization test, extract validation, extract pricing, extract persistence, rename; run tests and commit after each.
  • EX04 Keep tests with edge cases and requirement-based expectations; discard those mirroring implementation or asserting a known bug; change tests with wrong expected values.
  • EX05 Review time per PR, escaped defects or change failure rate, mutation score or flaky test rate; collect from the Git host, incident log, and CI.
  • Outcome 5 is also covered by the lab's mutation results and the practical review.

الاختبار

Outcomes: O1 context for assistants · O2 debugging with evidence · O3 refactoring under tests · O4 useful generated tests · O5 measuring effect.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1Best context for an assistant:O1
  2. 2Which must never be put in a prompt?O1
  3. 3An AI-suggested cause of a bug should be:O2
  4. 4The best first request when debugging:O2
  5. 5Safe refactoring with AI means:O3
  6. 6An AI step turns tests red. You:O3
  7. 7A generated test that mirrors the implementation:O4
  8. 8A surviving mutant means:O4
  9. 9A good measure of AI assistance:O5
  10. 10Who is responsible for AI-written code in a PR?O5

الجزء العملي

Five exercises MID-072-EX01 to EX05 plus the lab. Pass: at least four exercises correct, and a review of an AI-generated pull request that decides what to accept, change, or reject with reasons.

أخطاء شائعة

Large unreviewable AI diffs; accepting generated tests that assert current bugs; pasting secrets or customer data into prompts; measuring success by volume of generated code.

التقييم

Review an AI-generated pull request and decide what to accept, change, or reject, with reasons.

الصلة بالمسار الوظيفي

Rolling out AI tools across teams (SRB-022) and AI governance at Staff level (STF-021).

اكتب للبحث في المستويات والمراحل والوحدات والدروس.