الكود أولًا مقابل العقد أولًا
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
compare the two ways of producing a spec.
الموضوعات المخطط لها
- Code-first: write controllers, generate the spec. Fast and always matches the code; the design can become an afterthought.
- Contract-first: write the spec first, then generate or hand-write code to match. Good for reviews and parallel work with client teams; needs discipline to keep code in sync.
- The main risk of both is docs drifting from behavior; check the spec in tests or in CI.
- Commit the spec to the repository so changes show up in code review.
- Many teams use code-first for internal APIs and contract-first for public or partner APIs.
تفاصيل المخطط المبدئي
عرض عملي
| Approach | Strength | Risk |
|---|---|---|
| Code-first | Quick, matches code | Weak design review |
| Contract-first | Design agreed early | Code can drift |
اختبر فهمك
What is the shared risk of both?
أظهر الإجابة
Docs drifting from actual behavior.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.