Let's say I have a function Rotate (float angle). When I call this function, I probably won't remember if this function takes the angle in degrees or radians. For this reason, I call functions like these RotateDegrees (float angle). That's much better, especially, if I call my variables degAngle or radAngle. That way you can see at once if the code is correct without having to look at other places.
But there may be an even better way!
Why don't I just make a different class for every unit? Like
public class Degree
{
public float value;
public Degree (float value)
{
this.value = value;
}
}
and the same for hours, kilometers, mol, lightyears and so on.
That way there would be no ambiguity at all, I just have to make a bunch of overloads for every function, or define conversion operators for each class.
But I never saw code like that. Is it not that useful in practice? Also, the code I'm writing is performance critical, would there be any performance losses?