tags:

views:

29

answers:

1

Basically in my app I want to store all the nodes created by the user in a global list, say like:

GlobalComposition = { collection }

which will store nodes like:

ImageInput01, ImageInput02, Blur01, Sharpen01, Contrast01, Contrast02

What I can't decide is whether I should store them in a linear "1 dimensional" collection, or only store the base node that contains other nodes? So for something like:

ImageInput01 -> Blur01 -> Sharpen01 -> Contrast01

storing only ImageInput01.

This gives me the ability to use the same names for the action nodes that comes after the base node.

Which one would be better for unique naming system for nodes, performance, easily traversing the nodes in the composition, etc?

To me keeping the hierarchy seems more sensible but want to know people's thoughts.

+1  A: 

Certainly a hierarchy will give you more power from a taxonomy point of view. Also, searching a tree is more efficient than searching a 1-dimensional collection in most cases.

You'd also be able to use .ToList() for a 1-dimensional collection as long as you're using .NET generic collections, as well.

Unfortunately, a hierarchy is a bit harder to implement, but generally if there is an indication of a need for it, you'll be able to take good advantage of the features it'll provide you way down the line.

JoshJordan