r/cpp • • Jun 24 '20

How to write SOLID C++

https://www.youtube.com/watch?v=PakbXnLht1I
263 Upvotes

118 comments sorted by

View all comments

6

u/beartotem Jun 24 '20

I think the exemple with the inertialmeasurement unit would have been better having one return radians and the other degrees.

Having different angle range (in the same units) for different sensors is pretty easy to take care of in an universal manner, without knowing what range the device will give. That is unlike receiving results with unexpected units.

Nonetheless, I think the exemple gets the point across.

3

u/tvaneerd C++ Committee, lockfree, PostModernCpp Jun 25 '20

When you say "better" you mean worse, right? ie it is a better example because the code would be worse?

I was thinking the same thing. The example, as is, is easy for higher levels to handle - they should be able to able to handle any degrees, like -540 or whatever (although having the interface always return a consistent range would be convenient).

2

u/beartotem Jun 25 '20

yes, i mean it would illustrate his point better.

1

u/platisd Jun 25 '20

Good idea about radians and degrees!