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
Add outline for app-specific commands #71
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.
TL;DR
I'm sorry, but this PR is a mess (haha sorry if this comes across as harsh and/or savage but seriously though)
Details
There's a lot of duplicated problems, so I'll just lay it out here so you can fix it (see recommendations at the end of this review on what possible steps you can take in the future):
-
When you create a
Command
class, make sure that that class has the word "Command" at the end. For example, theAddAppointment
class should beAddAppointmentCommand
class. This issue has appeared multiple times. -
Also, when creating your Command classes, put them into subpackage (not at the same level as logic.command) so it's neater. This is a minor organizational issue, however, compared to the rest.
-
AddCommand
,EditCommand
,DeleteCommand
,FindCommand
etc are not generic commands. You can think of it as the AB3 developer's lazy way of omitting the word Person. They are pseudonyms forAddPersonCommand
,EditPersonCommand
etc. Please read the code before blindly extending them for your use, because I see you have extended these classes for your Appointment Commands, which is just silly because these classes pertain to modifying Persons, which is different from Appointments. If you have the intent of making these classes generic then I apologise for the miscomm, but from what I see this was not the intent. -
Also I see you've modified the MESSAGE_USAGE for these existing
Command
s e.g.AddCommand
etc to include your message usage. So now it will print something likeedit-pat|appt
. Apart from the obvious notion that this is incorrect (it is a whole command as is, if you wanted to edit the MESSAGE_USAGE it should've beenedit-pat or edit-appt
and not a lazy merger of the two). The command should only deal with itself. In addition, the syntax as agreed upon isENTITY-COMMAND
, which is completely different from the changes proposed in this PR. In addition this was based on the assumption that these existing classes were generic (refer to point 3 above), which is invalid (i.e. don't edit theAddCommand
etc Commands thinking they are generic Commands. They are not. They areAddPersonCommand
etc for Persons.) -
The assumptions made at points 3 and 4 culminate in the unnecessary / invalid changes made to the CommandParsers which leads to a lot of work done that is wasted.
I stopped adding code specific comments halfway through because the problems just kept repeating / kept escalating due to these invalid assumptions, so I've decided to put them all into this general review here for my (and your) convenience. Please revert and fix and please clarify before making any changes you are unsure of, because this PR is effectively useless considering almost all the observable changes are not in line with what we discussed and/or would not work, apart from the creation of AppointmentCommand class stubs (which again weren't fleshed out because their body was just copied).
What was good
Now, I would like to say I actually like the idea that you've tried to implement the COMMAND-ENTITY
idea. It does feel usable. But it's not really in line with what we've discussed, and it does make it harder for the autocomplete, amongst other issues that made us choose to do ENTITY-COMMAND
.
I would also like to praise you for the amount of work put in. It's no small amount to be certain.
But a mess is a mess and to avoid such scenarios from happening again, please ask/confirm in the group before making significant changes that can impact other parts of the code.
Recommendations on what to do next
I would recommend just reverting back to a previous commit-
No, I would actually recommend just ditching this branch and creating a new branch to start afresh from the main branch (after copying usable code from this PR to another folder somewhere for future reference) because all this extra work to fix what was done in this PR may not be worth it (apart from the stubs created, I don't see any content that can be kept). May want to keep the change for Ui.png though if you do this.
Thanks Sandy.
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
|
||
public class AddAppointment extends AddCommand { |
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.
AddAppointment should be named as "AddAppointmentCommand".
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.
The body of the function is understandably incomplete since it's a copy from the AddCommand, however, but don't forget the JavaDocs etc. You can replace them by selecting person using Alt+J and modifying as needed (this is case-sensitive, so make sure to select "person" and "Person")
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.
Also, why is AddAppointment extending AddCommand? Note that in the application, the "AddCommand" is effectively an "AddPersonCommand". Please do not be confused and think it is a generic class for adding items. It is not.
@@ -19,7 +19,9 @@ | |||
|
|||
public static final String COMMAND_WORD = "add"; | |||
|
|||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " | |||
public static final String MESSAGE_USAGE = COMMAND_WORD + "-" |
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.
I do not understand this. Commands should be separate. Why is the message usage here "add-pat|appt"? Didn't we agree on "pat-add" and "appt-add"?
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.
Note that in the application, the "AddCommand" is effectively an "AddPersonCommand". Please do not be confused and think it is a generic class for adding items. It is not.
|
||
public static final String COMMAND_OBJECT = "pat"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + "-" + COMMAND_OBJECT |
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.
The consensus was Object, dash, then Command. Please correct me if I misinterpreted this.
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "owesMoney"; | ||
|
||
public static final String MESSAGE_SUCCESS = "New person added: %1$s"; |
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.
Don't forget to update the messages and JavaDocs.
|
||
public static final String COMMAND_OBJECT = "appt"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + "-" + COMMAND_OBJECT |
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.
Object then Command
|
||
public static final String COMMAND_OBJECT = "pat"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + "-" + COMMAND_OBJECT |
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.
object - word
import seedu.address.model.person.Phone; | ||
import seedu.address.model.tag.Tag; | ||
|
||
public class EditAppointment extends EditCommand { |
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.
EditAppointmentCommand, and don't extend the EditCommand.
|
||
public static final String COMMAND_OBJECT = "appt"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + "-" + COMMAND_OBJECT |
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.
object - word
+ "by the index number used in the displayed person list. " | ||
+ "Existing values will be overwritten by the input values.\n" | ||
+ "Parameters: INDEX (must be a positive integer) " | ||
+ "[" + PREFIX_NAME + "NAME] " |
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.
Don't forget to update the body and the javadocs
+ PREFIX_PHONE + "PHONE " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" |
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.
I believe you can just remove this class and refactor the current AddCommand class.
Hi Matt, thanks for the review and I am sorry if I had to make you read through many lines of code you found quite redundant and messy. I think in some way I was trying to just create some dummy classes that could be modified later and fleshed out properly later, but as I see that perhaps is not a very useful way to go about this, so next time I do put a PR, I will ensure as much as I can from my side that the code is mostly in shape. This was a WIP that was not ready at all to be merged, but to just get some feedback on. Clearly, there were a lot of misunderstandings on my side that surfaced through this PR, so I guess that perhaps was the only good thing out of this. I would just like to clarify a few things as well based on your comments, if I am wrong on any of them please let me know:
Again, I am sorry. I believe this could have been quite frustrating and time consuming for you. This was more of an experiment on my side just to get some initial feedback. I will try to give better quality and cleaner code next time. And will try to push in small increments to avoid this. Will start fresh on a new branch as suggested and only focus on appointment commands first perhaps. |
Hi Sandy, don't worry. Regarding your questions:
|
As discussed during the afternoon meeting today, Sandy intends to make her changes on another branch. Closing this PR unless new info crops up |
Part of #65
view-visit
, etc. and modified later.