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: split controllers #66

Merged
merged 4 commits into from
Aug 8, 2023

Conversation

OlfaBensoussia
Copy link
Contributor

Description

This PR attempts to resolve #42
When looking at this issue, I thought about two ways to address it.
The first is to do it through dependency injection. The idea was to create a global interface for controllers, and then inject controllers into the new management class. The second one is to simply get inspiration from the facade design pattern, and have one class that wraps all of the other controllers through a simplified interface where we create instances of these controller classes. I went for the latter and would like to hear your opinions @ndr-brt @fdionisi

How to test it


Approach

Open Questions and Pre-Merge TODOs

Learning

Copy link
Contributor

@ndr-brt ndr-brt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was exactly what I had in mind, just separating things by context. 👍
I added a comment for naming things, then I saw that the tests disappeared, I was expecting to find them separated in different test classes

this.#inner = inner;
}

get assetController() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop the Controller word from these getters, so then the expression to, e.g. create an asset would be:
management.asset.create(...).
Maybe also adding the s could reflect the "rest resource" concept, becoming:
management.assets.create(...)

@OlfaBensoussia
Copy link
Contributor Author

@ndr-brt do you feel like we should also split tests exactly like we did for the sub controllers?

@ndr-brt
Copy link
Contributor

ndr-brt commented Aug 8, 2023

@ndr-brt do you feel like we should also split tests exactly like we did for the sub controllers?

@OlfaBensoussia definitely!

@OlfaBensoussia OlfaBensoussia force-pushed the refactor/reorganize-management-controllers branch from 962554a to 7cbf48e Compare August 8, 2023 14:49
@OlfaBensoussia OlfaBensoussia changed the title [WIP] refactor: split controllers refactor: split controllers Aug 8, 2023
@OlfaBensoussia OlfaBensoussia self-assigned this Aug 8, 2023
Copy link
Contributor

@ndr-brt ndr-brt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@ndr-brt ndr-brt merged commit 9b2ec3a into main Aug 8, 2023
@ndr-brt ndr-brt deleted the refactor/reorganize-management-controllers branch August 8, 2023 15:03
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.

Split management controller into sub-controllers
2 participants