-
Notifications
You must be signed in to change notification settings - Fork 73
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
[W6.2b][T16-2] Perry Wang #131
base: master
Are you sure you want to change the base?
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.
You have not updated your JUnit tests.
Please note that going forward you need to update the tests as well when you make any behaviour changes.
@@ -15,6 +15,7 @@ | |||
protected AddressBook addressBook; | |||
protected List<? extends ReadOnlyPerson> relevantPersons; | |||
private int targetIndex = -1; | |||
protected boolean mutatesData; |
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 variable is not used anywhere in your implementation. you may wish to omit this.
@@ -26,6 +27,10 @@ public Command(int targetIndex) { | |||
protected Command() { | |||
} | |||
|
|||
public boolean isMutating() { |
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.
Having a default implementation for isMutating()
in the parent class is good as it reduces the amount of code. However, using an arbitrary default return value (like true
) would reduce code understandability - as its subclasses implementations are returning false
. Instead, you could declare isMutating()
as an abstract method with no method body.
@@ -16,4 +16,8 @@ public CommandResult execute() { | |||
return new CommandResult(MESSAGE_EXIT_ACKNOWEDGEMENT); | |||
} | |||
|
|||
@Override | |||
public boolean isMutating() { |
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.
Remember to update your method with header comments as your overriden method has a different behaviour from the parent class implementation. e.g. Returns if true if class mutates data.
Added polymorphism to Command class