lundi 30 avril 2018

Composite design pattern definition

In the book Design Patterns : Elements of Reusable Object-Oriented Software, It says:

"The composite design pattern composes objects into tree structures to represent part-whole hierarchies."

In wikipedia the composite design pattern is defined as :

"The composite pattern describes a group of objects that is treated the same way as a single instance of the same type of object. The intent of a composite is to "compose" objects in to tree structures to represent part-whole hierarchies."

Picture of composite design pattern:

enter image description here

If my Composite stores components as directed acyclic graph( for example it only stores components which are sources of DAC in queue data structure and those sources have references to another components and so on... ) which is not tree because it violates some tree structure condition. Can I still say that I have used composite design pattern?

Aucun commentaire:

Enregistrer un commentaire