التصميم بالعقد أولًا (Contract-first)
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
agree on the API shape before writing code.
الموضوعات المخطط لها
- A contract lists URLs, methods, request and response bodies, and status codes.
- Write example requests and responses first; they are the cheapest way to find mistakes.
- Review the design with a peer or a client team before implementation.
- Changing a contract later costs more than changing a table on a whiteboard.
- The contract is not your entities: design DTOs for the client's needs.
تفاصيل المخطط المبدئي
عرض عملي
one table row plus examples
POST /products body {"name","priceCents","categoryId"}
201 Location: /products/5 body {"id":5,"name":"Pen",...}
400 {"type":"...","title":"Invalid request"}اختبر فهمك
What is reviewed before implementation?
أظهر الإجابة
The contract: endpoints, bodies, status codes.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.