-
Notifications
You must be signed in to change notification settings - Fork 232
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
Refactors code to support inheritance #198
base: master
Are you sure you want to change the base?
Refactors code to support inheritance #198
Conversation
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.
Looks like an awesome refactor to me!
I didn't filter my suggestions as well as I could have based on existing code vs new/refactored code; feel free to dismiss suggestions if you think they're out of scope.
How did you test these changes/can you describe the potential risks?
} | ||
} | ||
|
||
async remove() { |
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.
Can we have these abstract methods throw a not implemented exception? This would both make it clear that these should be overridden, and avoid weird cases down the road where we instantiate a Job
but avoid the constructor.
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, just check once. Didn't use a message because the stacktrace should already cover the method name from where the error originated.
Co-Authored-By: Eli Skeggs <[email protected]>
@skeggse Just wanted to confirm why have |
@skeggse A thorough testing is still required, I did testing with just bull queue of some of the basic functionalities that I was using. I thought to first get a review done before we can move onto complete testing again together. There should not be any potential risks associated as such, in this code refactor I carefully converted all the if and else statements to different classes. Not sure if I understood your statement here correctly. |
At present everywhere there are checks for whether the queue is bull or not based on which the functionalities differ.
In this PR, this task have been properly handled by using classes and inheritance where by which all the bee related logic goes in bee.js and all the bull related logic in respective bull.js.
If another queue has to be integrated in future, it will be so much easier to just write another implementation which implementation details which affecting the core functionalities of the UI.
This makes the code more concise, easy to understand and extendable without extra if else conditions.
Three classes are mainly used: