I have read several tutorials and posts and I can’t really understand one thing regarding to groupping items (and groupping groups)
What I have seen for example:
Group gGroup1
Group gGroup2 (gGroup1)
String foo (gGroup2, gGroup1)
Why you have to specify the two groups for an item? Doesn’t this Group definition means that Group2 is a part of Group1? Shouldn’t be enough just to group the item with the Group2?
You don’t have to. And personally I’d call that an anti-pattern. But there is nothing preventing one from defining Groups that way so long as you don’t have circular Group membership (e.g. gGroup1 were also a menber of gGroup2).
Yes
It depends on the purpose of the Groups. It helps to think about Groups as tags rather than a hierarchy. I wouldn’t recommend it but there is nothing wrong with it. For example, maybe someone is employing Design Pattern: Associated Items and both foo and gGroup2 are potential Items that the user wants to pull out of gGroup1. In that case gGroup1 doesn’t represent a hierarchy but a tag.
If you are using Groups to define a hierarchy then yes, you would never want to have an Item Grouped at multiple levels of the hierarchy. But that is the only way to use Groups.