-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: refactored strategies to use the template design pattern #171
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
Conversation
| abstract isEnabled(parameters: AppStudioMultiParameters, context: AppStudioMultiContext): boolean; | ||
| } | ||
|
|
||
| export function registerStrategies(appStudioMultiStrategy: AppStudioMultiStrategy): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method doesnt feel in the right place.
You define abstract class here for strategy and then comes this specific method which use instances of classes which implement this abstract class.
I would do it as instance method of AppStudioMultiStrategy class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppStudioMultiStrategy is a generic class that should not know the concrete implementation.
unleash_client_manager.ts manage AppStudioMultiStrategy, initialize and register the strategies
| const client = await initializeUnleashClient(extensionName, serverArgs, [new AppStudioMultiStrategy()]); | ||
| const appStudioMultiStrategy = new AppStudioMultiStrategy(); | ||
| const client = await initializeUnleashClient(extensionName, serverArgs, [appStudioMultiStrategy]); | ||
| registerStrategies(appStudioMultiStrategy); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer instance method: appStudioMultiStrategy.registerStrategies()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AppStudioMultiStrategy is a generic class that should not know the concrete implementation.
unleash_client_manager.ts manage AppStudioMultiStrategy, initialize and register the strategies
| @@ -1,11 +1,14 @@ | |||
| import { expect } from "chai"; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename the file to strategy.spec.ts as it is testing several files inside strategy folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
…nto stratRefactoring
…gle-node into stratRefactoring
No description provided.