in reply to Re: At what level of structural complexity is Moose a win-win?
in thread At what level of structural complexity is Moose a win-win?

Why would you want to store currency as two items, instead of storing it as an amount of cents alone?

What makes more sense in this context is to store a monetary amount as the currency it is in, together with the amount and potentially the place of the decimal point.

  • Comment on Re^2: At what level of structural complexity is Moose a win-win?

Replies are listed 'Best First'.
Re^3: At what level of structural complexity is Moose a win-win?
by chromatic (Archbishop) on Sep 29, 2010 at 16:12 UTC

    Sure, that's usually a better approach. I don't remember the details of why, but for one project it made sense to store dollars and cents separately. (Maybe it was because the retailer used the number of cents to indicate special information such as "manufacturer price" and "clearance price" and we didn't want to recalculate from decimal information every time.) Pre-breakfast, of course that was the first example to come to mind.