|
|
|
|
|
by davismwfl
1805 days ago
|
|
Primarily, forgetting to divide by 100 is an obvious error and easy to debug when compared to a database driver/interface being updated that tweaks the decimal conversion which is much more subtle and hard to debug. Your point is valid though in a situation where you only use one database system and one development language that both support decimal properly it isn't "bad" to use decimal, thought I'd still personally use integer for future proofing the data. Secondly (and why I'd still use integers regardless), every language supports integers and division, not every language can support decimals properly or consistently. So for guaranteed accuracy it is best to use integers. Web being so javascript driven is a primary consideration here. IMO this is something similar to dealing with time in distributed/complex systems. Sure there are types in postgres (and most DB's) that handles timezone, but it still is best to use UTC for everything stored in data and only do timezone conversions at the display layer when necessary. |
|
Timezones change, and far more frequently than you'd think.
So storing in UTC is only a good idea for dates in the past.
You'd be in for a world of hurt when the EU or UK finally decide to get rid of moving their clocks forwards/back. They've both been debating it for years. Or Turkey decides to move the start of summer time again with a couple of weeks notice.