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

Refactor all endpoints code #2426

Open
acicovic opened this issue Apr 23, 2024 · 4 comments
Open

Refactor all endpoints code #2426

acicovic opened this issue Apr 23, 2024 · 4 comments
Assignees
Labels
Type: Maintenance Type: Refactoring Items that result directly or indirectly in refactoring
Milestone

Comments

@acicovic
Copy link
Collaborator

Is your feature request related to a problem?

Our endpoints code is (maybe unnecessarily) scattered across files, has multiple levels of inheritance, and is generally complicated to follow/debug for contributors. As we keep adding more and more endpoints, this situation will only get amplified.

We need to refactor our endpoints to have code that is simpler and more maintainable in the long run.

Describe the solution you'd like

  1. Plan
    • Look at the existing code. Brainstorm and take notes on how it could possibly be refactored/simplified.
    • Discuss the ideas and take any feedback into consideration.
    • If needed, before, during or after the discussions, work on some proof of concept code to help conclude the feasibility or to visualize how the end result could look like.
    • End-up with a final approach.
  2. Implement
@acicovic acicovic added Type: Maintenance Type: Refactoring Items that result directly or indirectly in refactoring labels Apr 23, 2024
@acicovic acicovic added this to the Future Milestone milestone Apr 23, 2024
@acicovic acicovic modified the milestones: Future Milestone, 3.17.0 Jun 17, 2024
@acicovic acicovic modified the milestones: 3.17.0, Summer 2024 Jun 28, 2024
@acicovic
Copy link
Collaborator Author

acicovic commented Jul 9, 2024

@vaurdan, tagging you here for notifications, in case you're not receiving any from this thread.

@acicovic
Copy link
Collaborator Author

acicovic commented Jul 9, 2024

I think there could be 2 main approaches here:

  • Attempt to restructure everything from scratch.
  • Simplify specific aspects of what we have step by step, until we end up with something simpler.

I'd probably suggest option 2, but happy to hear if there are different opinions.

@acicovic
Copy link
Collaborator Author

acicovic commented Jul 9, 2024

Things to think about, in no particular order:

  • Currently our code is split among 2 files/classes (Endpoint + Remote API) in most cases. Is this differentiation useful, and does it simplify or complicate things for us?
  • We have at least one class that inherits from another class, while also extending an interface. Can we simplify that?
  • We might have interfaces that get implemented only in a specific file. In this case, maybe it's worth removing the interface?
  • Permission handling has become complicated, might have multiple levels. See if there are ways to handle this in a simpler way.
  • Are there other ways we can simplify the code without creating duplication, or at least too much of it?
  • If we think it's needed, are there any simple design patterns that we could use?

There might be other things I've missed, let's put them all together in this thread.

@acicovic
Copy link
Collaborator Author

acicovic commented Jul 9, 2024

There's also an effort and private conversation to make PCH work with WordPress.com, which involves some tinkering with the endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Type: Refactoring Items that result directly or indirectly in refactoring
Projects
None yet
Development

No branches or pull requests

2 participants