Often times in programming, we need to represent some value which can easily be represented using a simple primitive type.For example, in a game we might need to represent the velocity of a moving object. This could easily be represented with a double value. This object might also have a value of mass; this can also be represented with a double.Some would argue that we should have a Speed type and a Mass type for each of these, instead of the general-purpose double type. The argument for that is that this way we take advantage of 'strong-typing'; the compiler doesn't let us pass a speed for a mass or a mass for a speed and make mistakes like those.This argument makes sense. However, I can't help but thinking that this would be an overkill.So what would you use? A simple double (following KISS and keeping everything as simple as possible) or a type made for a specific purpose?
Would you create a specialized type just to wrap a primitive?
programming practices;type