3 ms·
I think the examples are just too trivial (or in this case, aren't extended to a greater library). Where they really come in handy is if you're using the types
by zastrowm 13y ago
I think the examples are just too trivial (or in this case, aren't extended to a greater library). Where they really come in handy is if you're using the types all over the place. If I were to create a Degrees class (with Celsius and Fahrenheit) just for representing it in a UI, I'd call it crazy. But if I'm doing conversions all over the place or creating a library for others to use, I would think the plumbing is worth it. Of course, that's true for most "plumbing" in code.
- eps 13y agoIf you are "doing conversions all over the place", you are looking at a fundamentally flawed code design that costs you performance. Ensuring consistency of coversions here is like painting a house whose roof's on fire. C/F example is synthetic, but it doesn't make it any good - if you are operating with data that can be expressed in different units, then pick a single unit, stick with it throught the code and convert only when displaying (or passing to external party code).
- deleted 13y ago[deleted]
- pdpi 13y agoOr perhaps you're integrating a large number of systems, each with its own conventions.