I have to update a road tunnel lighting program I wrote for a company. They now want a new standard to be applied, but with the option of switching between standards real time. And there will be other standards in the future.
Currently the single object which calculates the lighting curves along the length of the tunnel is a
CStd2003 m_Std ;
object in the application.
My immediate idea was that I could have a CStd base class and then a pointer rather than an object in the application:
CStd* m_pStd ; // Will be either CStd2003 or CStd2011
Then I looked in the docs to find out how much I'd actually have to change in the calculations. Less than 5%. And yea I felt as if I was in the wilderness being tempted by SATAN HIMSELF. And YEA Satan SAID:
"Listen sunshine, just use an enumerator inside CStd m_eStd which
can take ekStd2003 or ekStd20011 values. Then modify the calculations
according to the value of m_eStd."
And YEA I was sore tempted.
Should I give in to temptation.............?