طبقات التطبيق / The app's layers

الترتيب / Order
1 من 4 / 1 of 4
آخر تحديث / Updated
8 أكتوبر 2026 / 8 October 2026

أهداف الدرس

  1. أن تفصل الواجهة عن البيانات.
الطبقةمسؤوليتها
الواجهةترسم الشاشة وتستقبل اللمس
الحالةتحفظ ما تعرضه الشاشة الآن
الخدماتتتحدّث مع الخادم
التخزينتحفظ على الجهاز ما يلزم دون اتصال

الشاشة لا تستدعي الخادم مباشرة؛ تطلب من الحالة، والحالة تطلب من الخدمة. فيسهل الاختبار والتغيير.

تمرين

أين تحفظ آخر جدول محاضرات لعرضه دون اتصال؟

الإجابة

في طبقة التخزين، وتعرضه الحالة حتى يصل الجديد.

Lesson goals

  1. Keep the interface apart from the data.
LayerIts job
InterfaceDraws the screen, takes touches
StateHolds what the screen shows now
ServicesTalks to the server
StorageKeeps on the device what is needed offline

A screen never calls the server directly; it asks the state, which asks the service. That makes testing and change easy.

Exercise

Where do you keep the last timetable to show offline?

Answer

In the storage layer; the state shows it until the fresh one arrives.

التعليقات / Comments

لا تعليقات بعد. كن أول من يسأل. / No comments yet. Be the first to ask.

تعليق الطالب يظهر فوراً، وتعليق الزائر بعد موافقة المدرّس. / A student's comment shows at once; a visitor's once the teacher approves it.

في «تطوير تطبيقات الهاتف» / In “Mobile app development”

  1. 1طبقات التطبيق / The app's layersالتعليقات مفتوحة / comments open
  2. 2دورة الحياة / The lifecycleفيها صور / has picturesالتعليقات مفتوحة / comments open
  3. 3الحديث الآمن مع الخادم / Talking safely to the serverالتعليقات مفتوحة / comments open
  4. 4الروابط والبطاقة الرقمية / Links and the digital cardفيها صور / has picturesالتعليقات مفتوحة / comments open

↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق↑ ↓ to move · Enter to open · Esc to close