Within multiple methods of the Ball class, such as the constructor, we work with two parameters X and Y, which represent a location. Since both are conceptually related, we could encapsulate them in an object, such as Point. The advantages of applying this technique are: improved readability when using a Point object, since the purpose of the X and Y values is clear; easy to change, since if the representation of the location needs to be modified (for example, using polar coordinates instead of cartesian), the change is centralized in Point.


Within multiple methods of the Ball class, such as the constructor, we work with two parameters X and Y, which represent a location. Since both are conceptually related, we could encapsulate them in an object, such as Point. The advantages of applying this technique are: improved readability when using a Point object, since the purpose of the X and Y values is clear; easy to change, since if the representation of the location needs to be modified (for example, using polar coordinates instead of cartesian), the change is centralized in Point.

