If this place is not the proper place, please, point me where could I discuss/solve my doubts before closing the question.
It's a little thing I've had in my mind for a bit. In Java, and maybe other OOP languages, what would be better, to have...
class Entity {
[final] int xPos;
[final] int yPos;
// ...
}
or rather...
class Entity {
Position p;
// ...
}
class Position {
[final] int x;
[final] int y;
}
What are the pros and the cons of this? To me, it seems more practical to have the second approach, especially when you need to enter both properties as method parameter or return value, but I'm also thinking if this would produce too many unneeded procedures (creating new objects for minor things)...