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

[T5A1][T01-T4] Li Shicheng #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Li-Shicheng
Copy link

No description provided.

@@ -85,7 +85,8 @@ public CommandResult execute(String userCommandText) throws Exception {
private CommandResult execute(Command command) throws Exception {
command.setData(addressBook, lastShownList);
CommandResult result = command.execute();
storage.save(addressBook);
if (command.isMutating())
storage.save(addressBook);

Choose a reason for hiding this comment

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

The behavior of the code has been changed. Ensure the header comment and the tests have been updated.

Coding standard violation.

@@ -65,4 +65,9 @@ public int getTargetIndex() {
public void setTargetIndex(int targetIndex) {
this.targetIndex = targetIndex;
}

/*
* Returns whether the given command will change the data.

Choose a reason for hiding this comment

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

It is better to mention it returns true if the Command potentially mutates the data (header comments specify a contract, so try to be as precise as possible). E.g. Adding a duplicate person will not mutate data but the corresponding AddCommand object will still return true for this method.

@jeffryhartanto
Copy link

@Li-Shicheng
Some comments added. Please close the PR after reading comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants