it just feels wrong to have a class that does nothing but validate and store values
For me, it feels perfectly fine - as long as you can come up with a meaningful name for the class. I don't know your domain, but Angles
sounds pretty meaningless to me - but maybe it is just so inexpressive for the sake of this example, not in the real code. Same holds for convert
- give the function a name which expresses clearly what kind of conversion it does - from what input to what output. And the comment behind _Angle0
indicates the method should have a name like _validateAngle0
, for example.
Alternatively, consider to implement the conversion functions as class methods of Angle
. It is probably not possible to implement them as different Angle
constructors, since they are cannot be distinguished just by their signature, so class methods should be the canonical choice here.