التصميم للاتساق النهائي
في هذا الدرس 4 موضوعات
هذا الدرس مخطط له. يعرض المخطط أدناه الموضوعات التي سيغطيها، ولم يُنشر الدرس الكامل بعد.
نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.
في هذا الدرس
make lag a designed behavior, not a surprise.
الموضوعات المخطط لها
- Show honest intermediate states: "order pending", "payment processing".
- Return
202 Acceptedwith a status URL for work that finishes later. - Read-your-writes tricks: read from the primary after a write, return the created resource in the response, or pass a version the reader waits for.
- Make updates idempotent and commutative where possible so order does not matter.
- Expect conflicts to be rare but define a rule (last write wins, merge, or ask the user).
تفاصيل المخطط المبدئي
عرض عملي
POST /orders -> 202 Accepted, Location: /orders/42
GET /orders/42 -> {"status":"PENDING"} ...later... {"status":"CONFIRMED"}اختبر فهمك
Why return PENDING rather than waiting inside the POST?
أظهر الإجابة
Downstream steps are asynchronous; waiting hides lag and ties up resources.
التطبيق
طبّق هذا الدرس بمختبر الوحدة وتمارينها واختبارها.
تعليم الدرس كمكتمل اختياري ويمكنك التراجع عنه في أي وقت. يبقى تقدمك محفوظًا في هذا المتصفح.