المكتبة التقنية ←

ثلاث مشكلات في Oracle APEX تستحق المعالجة مبكرًا

English version

A slow page, scattered permission checks, and a growing pile of anonymous PL/SQL blocks can make an APEX application difficult to maintain. These were the three problems I highlighted in my original LinkedIn post. Here is a more practical way to approach them.

1. Measure performance before changing SQL

Start with the slow user action. Use APEX Debug and the browser's network tools to separate database time, network time, and rendering time. Then inspect the expensive SQL and its execution plan. Pagination and lazy loading can reduce unnecessary work; appropriate indexes can help specific access paths. A WITH clause alone does not guarantee faster SQL.

2. Centralize authorization

Define reusable authorization schemes and apply them to pages and operations. Hiding a button is useful for usability, but the server must also reject unauthorized requests. Keep role assignments in a trusted source and enforce row access where the data is read or changed.

3. Give business logic a home

Move repeated business rules into focused packages with clear names and small interfaces. Keep page processes easy to follow. Remove unused components only after checking dependencies, and leave a short explanation for decisions that will otherwise be mysterious six months later.

A useful review question is: can another developer explain how this operation is authorized, executed, and diagnosed without opening ten unrelated pages?

Editorial update: performance gains depend on measurement. This revision removes the original suggestion that these changes automatically double performance.

النسخة العربية

الصفحات البطيئة، وشروط الصلاحيات المتكررة، وكود PL/SQL المتوزع في أماكن كثيرة، من أكثر المشاكل اللي بتصعّب صيانة تطبيقات APEX. دي نفس المحاور اللي اتكلمت عنها في البوست الأصلي، لكن بخطوات أدق.

١. قِس الأداء قبل تعديل SQL

ابدأ بالعملية البطيئة فعلًا، واستخدم APEX Debug وأدوات الشبكة في المتصفح عشان تفصل وقت قاعدة البيانات عن الشبكة وعن عرض الصفحة. بعد كده راجع الاستعلام المكلف وخطة تنفيذه. التقسيم إلى صفحات وLazy Loading ممكن يقللوا الشغل غير الضروري، والـIndexes المناسبة تساعد حسب طريقة الوصول للبيانات. استخدام WITH لوحده مش ضمان لتحسين السرعة.

٢. وحّد إدارة الصلاحيات

استخدم Authorization Schemes قابلة لإعادة الاستخدام على الصفحات والعمليات. إخفاء الزر يحسن الواجهة، لكن لازم السيرفر نفسه يرفض الطلب غير المصرح به. مصدر الأدوار لازم يكون موثوق، وصلاحية الوصول للسجلات تتطبق وقت القراءة والتعديل.

٣. نظّم منطق العمل

انقل القواعد المتكررة إلى Packages واضحة، وخلي Page Processes قصيرة ومفهومة. قبل إزالة مكوّن غير مستخدم راجع الاعتماديات، وسجّل سبب القرارات المهمة بجملة أو اتنين.

اسأل نفسك: هل مطور تاني يقدر يفهم صلاحيات العملية وتنفيذها وتشخيص مشاكلها من غير ما يفتح عشر صفحات؟

تحديث تحريري: التحسين يتقاس عمليًا؛ الخطوات دي لا تضمن مضاعفة الأداء تلقائيًا.