انتقل إلى المحتوى
أمين أبوزيد
MID-024

نماذج الاتصال

  • 6 درس
  • 2.5 ساعة تدريب (تقدير)
في هذه الصفحة 8 موضوعات

نص الدروس والتمارين باللغة الإنجليزية، بينما تبقى واجهة الموقع وعناوين الدروس بالعربية.

نظرة عامة

الموضوعات

  • المتزامن مقابل غير المتزامن
  • REST مقابل gRPC
  • الطلب والرد (request/reply)

تعلّم أولًا

2.5 ساعة تدريب (تقدير)

مخرجات التعلم

  1. Compare synchronous request/response with asynchronous messaging for coupling, latency, and failure.
  2. Compare REST and gRPC (contracts, performance, tooling, browser support).
  3. Implement a gRPC service and client in Spring.
  4. Choose a communication style for each interaction in a system.

الدروس

  1. 01المتزامن مقابل غير المتزامن
  2. 02الاقتران الزمني (Temporal Coupling)
  3. 03REST مقابل gRPC
  4. 04gRPC وProtocol Buffers
  5. 05الطلب والرد عبر المراسلة
  6. 06عرض عملي: الاستدعاء نفسه في REST وgRPC

المختبر والتمارين

Lab

MID-024-LAB1 · Interaction map

Outcomes: 1–4 · Time: ~2.5 h

  1. List every Shop interaction (place order, check stock, charge payment, send email, update search, and others).
  2. Mark each sync or async and justify using coupling, latency, and failure impact.
  3. Implement inventory's stock check as a gRPC service and a client in orders with a deadline.
  4. Test behavior when inventory is down.

Acceptance: interaction map plus working gRPC call.

Exercises (assessment: interaction-design review; five exercises)

IDOutcomeTask
MID-024-EX011Explain how an outage of inventory affects orders in a sync design and in an async design.
MID-024-EX021Compute the availability of a chain of four services each at 99.9%.
MID-024-EX032Make a REST vs gRPC table with contract, performance, tooling, and browser support for a public and an internal API.
MID-024-EX043Write a .proto for GetProduct and ListProducts (server streaming) and add a field without breaking clients.
MID-024-EX054Choose and justify a style for: price lookup at checkout, order confirmation email, stock decrement after payment, search index update.
أظهر الحلول
  • EX01 Sync: orders fails or must handle errors immediately. Async: orders accepts the request and the stock step completes when inventory returns; the user sees a pending state.
  • EX02 About 0.999^4 = 0.996, so about 99.6%.
  • EX03 Public: REST (browser support, curl, OpenAPI). Internal: gRPC (strict contract, binary, streaming, generated clients).
  • EX04 Add optional string description = 5; with a new number, never reusing existing ones; keep rpc ListProducts (Query) returns (stream Product);.
  • EX05 Price lookup: sync. Email: async. Stock decrement: async event or saga step. Search index: async event. Justify by whether the caller needs the answer now.

الاختبار

Outcomes: O1 sync vs async · O2 REST vs gRPC · O3 gRPC in Spring · O4 choose a style.

اختبار ذاتي لك: لا توجد درجات، ولا يُحفظ أو يُرسل أي شيء. اختر إجابة ثم تحقق منها، ويمكنك المحاولة مرة أخرى كما تشاء.

  1. 1Synchronous calls couple services by:O1
  2. 2Async messaging mainly helps with:O1
  3. 3A five-service synchronous chain is risky because:O1
  4. 4gRPC typically uses:O2
  5. 5Which is true about browsers and gRPC?O2
  6. 6Protocol Buffers fields are identified on the wire by:O3
  7. 7A safe, backward-compatible change to a message is:O3
  8. 8Every gRPC client call should have:O3
  9. 9A price lookup needed to render checkout should be:O4
  10. 10In request/reply over messaging, the reply is matched with the request by:O4

الجزء العملي

Five exercises MID-024-EX01 to EX05 plus the lab. Pass: at least four exercises correct, an interaction map with justifications, and a working gRPC stock check with a deadline.

أخطاء شائعة

Synchronous call chains five services deep; async used for queries that need an immediate answer.

التقييم

Interaction-design review.

الصلة بالمسار الوظيفي

Integration patterns (ARC-024).

اكتب للبحث في المستويات والمراحل والوحدات والدروس.