4 ms·
> naming a function "move" and then having it return the sum of two vectors is bizarre and worse than the original implementation. I kept the name for the sake
by loup-vaillant 16y ago
> naming a function "move" and then having it return the sum of two vectors is bizarre and worse than the original implementation.
I kept the name for the sake of consistency. I agree that's a mistake. The problem is that a `Point` should be moved with a `Vector`, and not another point. But introducing a `Vector` class would have lengthen my tutorial. Maybe I should use two `floats` instead of a `Point`.
- th 16y agoThat example bothered me as well mostly because when the move function is placed outside of the class it is now performing a different action. The new function no longer really moves a point so much as it adds two points (regardless of the point/vector issue). I think many of the naming conventions commonly used in OOP for mutable objects are not as appropriate for their immutable counterparts.