jpalmieri / brewery

Make and share homebrew recipes (ones that actually make beer, irl)
http://brewery-jpalmieri.herokuapp.com
0 stars 0 forks source link

added recipe#abv #15

Closed jpalmieri closed 9 years ago

eliotsykes commented 9 years ago

Excellent work on getting the related feature and model specs written alongside the #abv calculation.

Only feedback for this is that in the Recipe model, where there are hardcoded numbers in the new method (or elsewhere), (e.g. 1.05, 0.0079 in the abv method), to replace them with named constants. Mystery numbers like this are sometimes called magic numbers.

Apologies for the irrelevant example constants that follow:

class Recipe
  # Constants often declared near the top of class/module
  PI = 3.14
  MILLILITERS_PER_IMPERIAL_PINT = 568
  MAX_BOIL_TIME_IN_SECS = 100 * 60
  ...
end
jpalmieri commented 9 years ago

:+1: Good point. I've just been blindly following these formulas, so I should figure out what those constants actually are anyway!

jpalmieri commented 9 years ago

I can't seem to find any info on these constants in home brewing documentation. I'll have to dig deeper another time.