Relative Content

Tag Archive for code-smell

Is it bad practice to make a subclass in name only for readability?

I have three sensors in a single package that all need to be calibrated which I will call sens1, sens2, and sens3. The calibration for sens1 and sens2 are identical, but the calibration for sens3 requires an extra parameter. My question is, “What is the best way to deal with three near-identical objects while still maintaining readability?”

Use of static methods to implement logic within a class

I’ve recently caught an odd behaviour in my own coding: At some point in the last year I began creating protected static methods to implement the logic of my public methods, ensuring that the protected static version contains all of the logic, but is not affected by state.