3 ms·
Production code likely should use neither double for currency nor LocalDateTime for a point in time. But for the purpose of the article, which is about Records
by pintxo 7y ago
Production code likely should use neither double for currency nor LocalDateTime for a point in time.
But for the purpose of the article, which is about Records being a new type of Java class, this is kind of irrelevant.
- nitrogen 7y agoI think it's kind of a problem if examples of how to write Java are full of bad practices.
- barnaclejive 7y agoExamples are usually bad production code. The sky is blue.
- pgwhalen 7y agoFor what it's worth, I work at a place that would write a similar domain object, and we would use both of those and not feel bad about it. The FUD on money as a double is way overblown in my opinion - it only becomes a bad idea once you have to do precise math with the it (which is admittedly a lot of the time when you're dealing with money, but surprisingly rarely in some domains).