ENع
الدرس 32 · Designing code

Clean code

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

Code is read far more often than it is written, so good code is written for the next person who reads it. Take a messy 10-line Python function and clean it up one change at a time: say each rule once, follow PEP 8, choose clear names, name the magic numbers, write comments that say why, and give each function one job. Tests prove every answer stays the same; then one deliberate fix makes bad input fail loudly.

12 دقيقة10 خطوات5 أسئلةIntermediate
شكل 32 · تفاعلي
جارٍ تحميل الرسم…
أو ← →

اختبار يتاح بعد الخطوة الأخيرة.