-
Notifications
You must be signed in to change notification settings - Fork 5
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 of table commands #131
Conversation
execute(): void { | ||
|
||
const selection= this.model.selection; | ||
execute(above: boolean, selection: ModelSelection = this.model.selection) { |
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.
using a boolean to determine behavior is a bit of a code smell IMHO. I find that usually it's better to have two differently named methods in such cases. In this case I think that translates here into having two separate commands. We can still use abstractions to avoid code duplication, but giving the specific behavior its own name makes it easier to look for the specific usage later on. It's usually quite hard to search for a method with a certain param value (though some IDE's can do that for you)
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.
That's a good point. I wasn't too sure about this either. I gave the insert column before and after + row above and below their own classes again, that make use of the abstraction made earlier.
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 good!
Some small changes to commands that work on tables.
Combine insert row above and below + insert column before and after.