DRY وKISS وYAGNI وحدودها
في هذا الدرس 4 موضوعات
محتوى هذا الدرس مكتوب وينتظر المراجعة. يعرض المخطط أدناه ما سيغطيه، وسيُنشر بعد اعتماده.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
apply three rules and know when they clash.
الموضوعات المخطط لها
- DRY: do not repeat the same knowledge in many places.
- KISS: keep it simple; the simplest design that works.
- YAGNI: do not build things you do not need yet.
- Conflict: removing small duplication can make code more complex (DRY against KISS).
- Rule of thumb: wait for the third repeat before you abstract; similar code is not always the same knowledge.
تفاصيل المخطط المبدئي
عرض عملي
two similar methods; one merge that needs a flag parameter and gets harder to read.
اختبر فهمك
When do you abstract repeated code?
أظهر الإجابة
When the same idea appears about three times and is really the same.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.