Explaining the class diagram presenting a new structure for the graphic components hierarchy in symbolist.
Old and new components hirarchy.pdf
The main changes are (from top to bottom):
The SymbolistComponent class looses the « subcomponents » reflexive relationship. This relationship is moved downward between the CompositeComponent and the ScoreComponent.
I checked and only ScoreComponent instances are using the subcomponents relationship. SymbolistMainComponent, PaletteComponent and the other direct subclasses of SymbolistComponent are not using subcomponents, instead they are using the « childComponentList » attribute from the JUCE::Component class. So we can seamlessly remove the subcomponents relationship from SymbolistComponent.
The « selectedComponents » relationship between ScoreComponent and SymbolistComponent is also moved downward between CompositeComponent and ScoreComponent as it is a subset of the subcomponents relationship.
Two classes are created in the new structure: SimpleComponent, which is the superclass of all childless components, and CompositeComponent, which is the superclass of all components composed of multiple components. The BaseComponent class is removed and its methods and instance variables are either moved to the ScoreComponent class or distributed between the ScoreComponent, SimpleComponent and CompositeComponent classes.
The PageComponent now inherits from the CompositeComponent class as it is a specific case of components composition. I’m not sure about this as it enables the composition of PageComponent within CompositeComponent (a staff of PageComponent or a symbol group of PageComponent…).
The StaffComponent class can either keep its « symbolsOnstaff » relationship (now pointing to the ScoreComponent class), or can loose it as it is redundant with the subcomponents relationship. In the new structure diagram the first solution has been retained
Explaining the class diagram presenting a new structure for the graphic components hierarchy in symbolist. Old and new components hirarchy.pdf
The main changes are (from top to bottom):
The SymbolistComponent class looses the « subcomponents » reflexive relationship. This relationship is moved downward between the CompositeComponent and the ScoreComponent. I checked and only ScoreComponent instances are using the subcomponents relationship. SymbolistMainComponent, PaletteComponent and the other direct subclasses of SymbolistComponent are not using subcomponents, instead they are using the « childComponentList » attribute from the JUCE::Component class. So we can seamlessly remove the subcomponents relationship from SymbolistComponent.
The « selectedComponents » relationship between ScoreComponent and SymbolistComponent is also moved downward between CompositeComponent and ScoreComponent as it is a subset of the subcomponents relationship.
Two classes are created in the new structure: SimpleComponent, which is the superclass of all childless components, and CompositeComponent, which is the superclass of all components composed of multiple components. The BaseComponent class is removed and its methods and instance variables are either moved to the ScoreComponent class or distributed between the ScoreComponent, SimpleComponent and CompositeComponent classes.
The PageComponent now inherits from the CompositeComponent class as it is a specific case of components composition. I’m not sure about this as it enables the composition of PageComponent within CompositeComponent (a staff of PageComponent or a symbol group of PageComponent…).
The StaffComponent class can either keep its « symbolsOnstaff » relationship (now pointing to the ScoreComponent class), or can loose it as it is redundant with the subcomponents relationship. In the new structure diagram the first solution has been retained