Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Applying Refactoring Technique: Introduce Parameter Object #23

Open
ManzanillaSebastian opened this issue Jan 13, 2025 · 0 comments
Open

Comments

@ManzanillaSebastian
Copy link

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.
Captura de pantalla 2025-01-12 204239
Captura de pantalla 2025-01-12 204441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant