My problem is that I have a Class A
with some Parameters
that I use in a few other Classes but during initializing one of these Classes I always have to set the parameters for Class A
as well. I not know how to solve these redundancies. Let me give you an example.
I have a big dataset that I reduce, using some calculations to one column depending on some input parameter
Class ColumnCreator
Sub New(a,b,c,d)
This ColumnCreater
is a Class I use in different other Classes. E.g. for a special Report:
Class SpecialReport
Sub New(e,f,g,a,b,c)
Sub Create_Columns()
dim myColumn = ColumnCreator(a,b,c)
I created a GUI
so a User can create his own report depending on the arguments he sets. BUT I always have to set the Parameters a,b,c
that I need for the Create_Columns Class
in the Constructor of the Class that uses these Class as you can see in the constructor of SpecialReport New(...,a,b,c)
. This must be a problem many programmers are facing and I do not know how to handel this. My first Idea was to write some kind of Parameter Container Class
.
Class ParContainer
Sub(a,b,c)
But this does not make the code better at all. I hope I made myself clear. Any ideas how to solve this? C# code is ok too.
Aucun commentaire:
Enregistrer un commentaire