Identify and apply data-oriented programming best practices in Java to improve code clarity, maintainability, and predictability by strictly separating data structures from behavior and ensuring all data transformations are explicit, pure, and traceable.
Core areas: Records for immutable data carriers over mutable POJOs, data-behavior separation with pure static utility classes holding operations, pure functions for data transformation that depend only on inputs and produce no side effects, flat denormalized data structures with ID-based references over deep nesting, generic Map representations for dynamic schemas converted to specific types when needed, Optional...
Prerequisites: Run ./mvnw compile before applying any changes. If compilation fails, stop immediately — do not proceed until the project compiles successfully.
استخدمه عندما تحتاج إلى تطبيق أفضل ممارسات البرمجة الموجهة للبيانات في Java - بما في ذلك فصل التعليمات البرمجية (السلوك) عن هياكل البيانات باستخدام السجلات، وتصميم البيانات غير القابلة للتغيير باستخدام وظائف التحويل النقية، والحفاظ على البيانات مسطحة وغير طبيعية باستخدام المراجع المستندة إلى المعرف، بدءًا من تحويل هياكل البيانات العامة إلى أنواع محددة عند الحاجة، وضمان تكامل البيانات من خلال وظائف التحقق من الصحة النقية، وإنشاء طبقات عامة مرنة للوصول إلى البيانات. جزء من مشروع مهارات جافا المصدر: jabrena/cursor-rules-java.