[W5][T11-2]Li Guanlong - #34
Conversation
|
|
||
| == Updating a person: `update` | ||
|
|
||
| Update an existing person in the address book. + |
There was a problem hiding this comment.
"Updates", remember to check for consistency in user guides because it is written by all your teammates, so there needs to be a uniform style of writing for the user guide to appear professional and neat. :)
| } | ||
| public static final String MESSAGE_UPDATE_PERSON_SUCCESS = "Updated Person: %1$s"; | ||
| public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; | ||
| @Override |
There was a problem hiding this comment.
Try to add blank lines to your code, it improves readability.
| final int targetIndex = parseArgsAsDisplayedIndex(index); | ||
| final Matcher matcher = PERSON_DATA_ARGS_FORMAT.matcher(rest.trim()); | ||
| if (!matcher.matches()) { | ||
| return new IncorrectCommand(String.format(MESSAGE_INVALID_COMMAND_FORMAT, AddCommand.MESSAGE_USAGE)); |
There was a problem hiding this comment.
Instead of using AddCommand's MESSAGE_USAGE, maybe try adding a separate "error message" to be more specific in the error handling process so when the system prints out the "message" you will be able to identify which exact part of your code it is running (instead of having the same message appear for 2 different situations).
| } | ||
| } | ||
|
|
||
| private Command prepareUpdate(String args) { |
There was a problem hiding this comment.
Missing header comment. All non trivial methods should have javadoc format header comments.
|
Great enhancement! It is a useful command that can be used in our project haha |
|
Hey Guan Long, interesting enhancement! It saves users from the trouble of first deleting an existing entry and subsequently re-adding him/ her with the updated particulars! Good Job! |
Added a new command: update, which is used to update an existing contact at the specified index.