It was quite hard to put what I meant into a title, but it's easy to put into code.
C++
Is this
int offset_x = 10;
int offset_y = 40;
...
element.move(offset_x, offset_y);
To be preferred over this?
Vector<int> offset(10, 40);
...
element.move(offset.x, offset.y);
(Note that Vector is not like std::vector
, it's a 2D vector. This class has lots of methods I don't need here, like normalize()
and scale()
. Should I have a more basic Point
class for this?)
JavaScript
Is this
var offsetX = 10;
var offsetY = 40;
...
element.move(offsetX, offsetY);
To be preferred over this?
var offset = {x: 10, y: 40};
...
element.move(offset.x, offset.y);