يوفر نمط Facade واجهة مبسطة إلى نظام فرعي معقد — حيث يخفي تعقيده خلف نقطة دخول واحدة نظيفة. يجعل مجموعة معقدة من المكونات أسهل في الاستخدام، دون إزالة الوصول إلى التفاصيل الأساسية.
ما يفعله نمط Facade
FACADE → a SIMPLE interface in front of a COMPLEX subsystem:
→ the subsystem has many components/steps; the facade provides ONE easy interface
→ clients use the simple facade instead of dealing with the complexity directly
→ the facade coordinates the underlying components
→ HIDE complexity behind a clean, easy-to-use interface
مثال
{
() {
codec = ().(file);
decoded = ().(file, codec);
result = ().(decoded, format);
result;
}
}
().(, );
