I have a situation where two different methods are getting the same list of parameters. (Specifically Adding and updating a row in a grid: Me.grdInfo.Rows(I).SetValues(A,B,C…) and Me.grdInfo.Rows.Add(A,B,C…) ) Now I am thinking to myself: Self when I add a new column or need to change a parameter will I remember to make the needed change in both places? BTW there are 16 parameters being passed and I get uncomfortable with more than 3. I come from the OOP school that >80% of the methods in a Class should have no parameters, <15% one, <5% two, <1 % three and <<1% more than three)
Anyhow this is not a critical issue, and many (Most?) developers would say this is not an issue at all but I am trying to see if there is a better/more elegant solution. Now if this was my methods calling another of my methods I would just pass the information via a structure, e.g. a single parameter object.
Wait now that I am typing this I have an Idea. Why not create a structure that contains all of the ‘parameters’ plus one more element which is a ‘flag’ that says if this is an add or update. Send that to a method that calls the correct grid method. Hmmm I think I will try this.
Other suggestions, ideas, better solutions? Am I drinking too much OOP cool-aid?
Lion Crest Software Services
Anthony L. Testi
President
Anyhow this is not a critical issue, and many (Most?) developers would say this is not an issue at all but I am trying to see if there is a better/more elegant solution. Now if this was my methods calling another of my methods I would just pass the information via a structure, e.g. a single parameter object.
Wait now that I am typing this I have an Idea. Why not create a structure that contains all of the ‘parameters’ plus one more element which is a ‘flag’ that says if this is an add or update. Send that to a method that calls the correct grid method. Hmmm I think I will try this.
Other suggestions, ideas, better solutions? Am I drinking too much OOP cool-aid?
Lion Crest Software Services
Anthony L. Testi
President