Skip to content

Applying Refactoring Technique: Introduce Parameter Object #23

@ManzanillaSebastian

Description

@ManzanillaSebastian

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions