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

Reduce code duplication #4377

Closed
2 tasks done
mifi opened this issue Mar 24, 2023 · 1 comment · Fixed by #4573
Closed
2 tasks done

Reduce code duplication #4377

mifi opened this issue Mar 24, 2023 · 1 comment · Fixed by #4573
Labels

Comments

@mifi
Copy link
Contributor

mifi commented Mar 24, 2023

Initial checklist

  • I understand this is a feature request and questions should be posted in the Community Forum
  • I searched issues and couldn’t find anything (or linked relevant results below)

Problem

I think that when logic has been copy-pasted to more than 2-3 places, it's usually time to refactor and make a common abstraction.

There is plenty of plugin logic that has been duplicated between plugins. This leads to the problem where the code constantly drifts apart: someone fixes a bug or introduces something in one plugin, but forgets to also update the same copy-pasted code in other plugins. I see this happening often with bugs that are being reported for one plugin, and we fix it, but in reality the problem exists in all plugins, so we need to go back and fix the others too.

Problematic code (feel free to edit and add more):

Solution

Pull out the code into a common abstraction (e.g. shared function or super class method)

Alternatives

use // LOUD COMMENTS to warn developers that they need to update code multiple places if they try to change code in one plugin

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

Successfully merging a pull request may close this issue.

3 participants