Friend spotlight!
Whimsical Animations course
Friend spotlight!
NEW Whimsical Animations course
Friend spotlight! NEW Whimsical Animations course
huge discount only this week
Friend spotlight! Want to make your project stand out? NEW Whimsical Animations course huge discount only this week
Composite

Composite を PHP で

Composite 構造に関するデザインパターンの一つで オブジェクトを木のような構造に構成し あたかも単一のオブジェクトであるかのように扱えるようにします

Composite は ツリー構造の構築を必要とする問題の大部分の解決策として かなりの人気を得るようになりました Composite の大きな特徴は ツリー構造全体でメソッドを再帰的に実行し 結果をまとめあげることです

複雑度

人気度

使用例 Composite パターンは オブジェクト・ツリーを扱う時 よく使われます 最も単純な例としては このパターンの DOM ツリーの要素への適用があげられます ツリー内の複合要素も単純要素も同様に扱います

見つけ方 オブジェクト・ツリーがあって ツリーのそれぞれのオブジェクトが同じクラス階層の部分であれば 十中八九 コンポジットです もしこれらのクラス中のメソッドが ツリーの子オブジェクトに仕事を委任し それを階層の基底クラスやインターフェースを介して行うなら これは間違いなくコンポジットです

他言語での Composite

Composite を C# で Composite を C++ で Composite を Go で Composite を Java で Composite を Python で Composite を Ruby で Composite を Rust で Composite を Swift で Composite を TypeScript で