For example I have a class that builds the GUI, a class that handles all the events for the GUI and the main class that holds all the objects that are affected by the GUI-Objects (mostly sliders) and instances both the GUI-class and event-class.
Now the event-class’s constructor has as arguments the GUI class and every object that is being changed by the GUI. These are quite allot of objects so the amount of arguments I have now are about 8 and still growing.
Is there a more elegant solution to my problem, 30 arguments simply doesn’t feel right?
ps, I’d rather not combine classes because all three are quite big and would make everything much less readable.
You can create a configuration class which holds default values for all parameters:
Now you can simply create your GUI class instance like this:
or for using only defaults: