-
Notifications
You must be signed in to change notification settings - Fork 19
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
[Hong Jiancheng] iP #4
base: master
Are you sure you want to change the base?
Conversation
src/main/java/Parser.java
Outdated
case "todo": | ||
store.addToDoToTemp(others); | ||
ui.printLine(); | ||
ui.indentPrint("Got it. I've added this task: "); | ||
ui.indentPrint(" "+store.getTask(store.getSize()-1).toString()); | ||
ui.indentPrint( "Now you have "+store.getSize()+" tasks in the list."); | ||
ui.printLine(); | ||
break; | ||
case "deadline": | ||
store.addDeadlineToTemp(others); | ||
ui.printLine(); | ||
ui.indentPrint("Got it. I've added this task: "); | ||
ui.indentPrint(" "+store.getTask(store.getSize()-1).toString()); | ||
ui.indentPrint( "Now you have "+store.getSize()+" tasks in the list."); | ||
ui.printLine(); | ||
break; | ||
case "event": | ||
store.addEventToTemp(others); | ||
ui.printLine(); | ||
ui.indentPrint("Got it. I've added this task: "); | ||
ui.indentPrint(" "+store.getTask(store.getSize()-1).toString()); | ||
ui.indentPrint( "Now you have "+store.getSize()+" tasks in the list."); | ||
ui.printLine(); | ||
break; |
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 felt these codes are highly repeated with each other, but don't know how to make it nicer.
Any suggestions?
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 would consolidate the steps (print the message, print the task) and write a new function to handle it
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.
Sounds great! I will try to work in this direction.
* branch-Level-5: A-AbstractClasses: Use Abstract Classes A-CodeQuality: Improve Code Quality
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.
Overall, it is very good. The program follows coding standard and it has high code quality.
command = input; | ||
others = ""; | ||
} | ||
switch (command) { |
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 like this part. Using "switch" to compare the input can maximise readability and easier for user to read
src/main/java/duke/Parser.java
Outdated
ui.indentPrint( "Now you have "+store.getSize()+" tasks in the list."); | ||
break; | ||
case "deadline": | ||
if(others.isEmpty()){ |
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.
It is good to have empty value checking. To further improve, I would like to suggest to create a new method/function to check empty value regardless it is "deadline","event",“todo","done". Then, it can help you avoid the long method (getCommand ).
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.
Make sense, will try to create a function to handle it.
src/main/java/duke/Storage.java
Outdated
String by = toAdd.split(" /by ")[1]; | ||
tempStorage.add(new Deadline(description,by)); | ||
} | ||
public void addEventToTemp(String toAdd) throws DukeException{ |
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.
It is great, you have multiple Exception cases. the error message is meaningful to the user.
* master: A-AbstractClasses: Use Abstract Classes
Branch level 6
* 'master' of https://github.com/pigoliver/ip: Level 6. Delete
* branch-Level-7: Level 7. Save
* branch-A-JavaDoc: A-Jar: created a jar file A-JavaDoc: Add JavaDoc comments
Level 9. Find
A-JUnit: Add JUnit Tests
BCD-Extension: Duplicate Check
Better GUI with higher coding standard
Final Enhancement with help command and duplicate command improvement
Update project documents
Update Developer Guide Images
No description provided.