4 ms·
I think using OO properly would solve this. You have a carbs class that you can instantiate (and update) with two arguments: value and units. This gets converte
by patrickyeon 14y ago
I think using OO properly would solve this. You have a carbs class that you can instantiate (and update) with two arguments: value and units. This gets converted into whatever representation you use internally, and then whenever you want to access the value, you would do carbs.grams() or carbs.breadUnits() or whatever other units are needed. I don't see a need for a convert() method (maybe as a static function if you want to be able to convert units without instantiating a carbs object, but now we're moving away from the discussion at hand).
- coreygoodie 14y agoExcellent point.