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 でデータ指向プログラミングのベスト プラクティスを適用する必要がある場合に使用します。これには、レコードを使用したデータ構造からのコード (動作) の分離、純粋な変換関数による不変データの設計、ID ベースの参照によるデータのフラット化と非正規化の維持、必要に応じて特定の型に変換する汎用データ構造から開始、純粋な検証関数によるデータ整合性の確保、柔軟な汎用データ アクセス レイヤーの作成などが含まれます。 Skills-for-Java プロジェクトの一部 ソース: jabrena/cursor-rules-java。