Ok, Here's one that is killing me and I can't figure out the best way to do this. Lets say I have a "Food" that has its main macronutrients i.e. protein, carbs, fat. But these amounts are based off of a certain portion size. If I had to be able to adjust the "size" of the portion and rescale the amount of all the macronutrients for a specific meal, how would I model the "Food". I was thinking something like always store the food in its serving size and then have a "Rescale" object that would take in the unit and size and rescale to a new unit and size. Does that sound correct? Or is it better to store the food at the lowest common denominator i.e. 1 oz of this is these macronutrients and then it is easier to rescale. But thats not true because I could have cup/oz conversions that hold true and then there is the whole metric system. Argh!!!
Food
-----
name:String
servingSize:double (1, 0.5, etc...)
unit:int (oz, cup, etc...)
NutritionalInformation
NutritionalInformation
----------------------
protein:double
carbs:double
fat:double
Rescaler
--------
--------
rescale(fromSize, fromUnit, toSize, toUnit)
Spend like you don't need the money,
love like you've never been hurt and dance like no one's watching!
Food
-----
name:String
servingSize:double (1, 0.5, etc...)
unit:int (oz, cup, etc...)
NutritionalInformation
NutritionalInformation
----------------------
protein:double
carbs:double
fat:double
Rescaler
--------
--------
rescale(fromSize, fromUnit, toSize, toUnit)
Spend like you don't need the money,
love like you've never been hurt and dance like no one's watching!