I am trying to clean some code and am struggling to decide on the most optimal solution
I have a class along the lines of "HouseInfo" which just stores a bunch of variables. We are talking hundreds. There is no logic in it.
In a lot of places in the code, i need to pass various "HouseInfo" parameters.
Ex:
Contractor.CheckForUpggradeFeasibility( HouseInfo.Length, HouseInfo.Width, HouseInfo.Height)
There are maybe a dozen or so "HouseInfo" variables which will be passed in various combinations.
I don't want to pass all of "HouseInfo" into these methods, but i do want to pass "One thing".
The solution i came up with is to have something along the lines of
Contractor.CheckForUpggradeFeasibility( HouseInfo.getSerializedData())
The getSerializedData would return some object that has a defined subset of variables that will satisfy all methods that require info from "HouseInfo".
I am pretty sure this design element exists, but i never encountered it. Should that SerializedData be a vector of some sort? A map? Another user defined object?
What is the cleanest way to do this with focus on maintanability?
Aucun commentaire:
Enregistrer un commentaire