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

Remove duplicated code in joint class derivatives - with interface and method extraction #302

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

diogomene
Copy link

What was done?

To address the code duplication identified in Joint-derived classes, an interface was introduced and implemented by the classes containing the repetitive routine. Subsequently, a method was added to the Joint class, which accepts as a parameter instances of classes inheriting from Joint and implementing the newly created interface.

This approach was chosen because the differences between the classes with the duplicated routine and those without it are minimal, making the abstraction of a new parent class unnecessary. A new class would have added only a few attributes and a single functionality, which would not have significantly improved code maintainability or readability.

All relevant Joint-derived classes now implement the ConstrainedBodiesJoint interface, ensuring the extracted initialization function can be applied uniformly.

As a result, code duplication has been reduced, and a clean mechanism for handling common initialization logic has been introduced. The inheritance structure remains unchanged, minimizing invasive modifications to the codebase while enhancing maintainability.

Resolve #301

Copy link

vercel bot commented Nov 17, 2024

@diogomene is attempting to deploy a commit to the Piqnt Team on Vercel.

A member of the Team first needs to authorize it.

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

Successfully merging this pull request may close these issues.

Remove repetitive code at Joint inherited classes with fucntion extraction
1 participant