-
Notifications
You must be signed in to change notification settings - Fork 193
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
[Wang Zhihuang] iP #181
base: master
Are you sure you want to change the base?
[Wang Zhihuang] iP #181
Conversation
Tweaked code to comply with coding standard Added javadocs for non-trivial methods and classes Added logo
src/main/java/Task.java
Outdated
public String getAt() { | ||
return ""; | ||
} | ||
|
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 might be better to have a blank line among each function.
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 agree. It may be minor but it can help make the functions look more distint and clear.
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, I found your code easy to read, except the parts where more distinction and separation could have been made between blocks of code. Otherwise, looks good!
src/main/java/Ui.java
Outdated
public void start() { | ||
String lineBreak = " ____________________________________________________________\n"; | ||
String logo = "\n" + | ||
" \n" + | ||
" ,--. ,------. ,--. ,--. ,--. \n" + | ||
",-' '-.,---.| .-. \\ ,---.| | `--',---,-' '-. \n" + | ||
"'-. .-| .-. | | \\ | .-. | | ,--( .-'-. .-' \n" + | ||
" | | ' '-' | '--' ' '-' | '--| .-' `)| | \n" + | ||
" `--' `---'`-------' `---'`-----`--`----' `--' \n" + | ||
" \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.
interesting twist to the Duke java graphic provided with the starting template!
src/main/java/TaskManager.java
Outdated
if (getSize() == 1) { | ||
System.out.println(" Now you have " + 1 + " task in the list."); | ||
} else { | ||
System.out.println(" Now you have " + getSize() + " tasks in the list."); | ||
} |
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.
Minor style and language taken care of. Nice!
src/main/java/Task.java
Outdated
public String getAt() { | ||
return ""; | ||
} | ||
|
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 agree. It may be minor but it can help make the functions look more distint and clear.
src/main/java/TaskManager.java
Outdated
switch(taskType) { | ||
case "todo": | ||
newTask = new ToDo(description); | ||
taskList.add(newTask); | ||
break; | ||
case "deadline": | ||
String by = getDate(task); | ||
newTask = new Deadline(description, by); | ||
taskList.add(newTask); | ||
break; | ||
case "event": | ||
String at = getDate(task); | ||
newTask = new Event(description, at); | ||
taskList.add(newTask); | ||
break; | ||
default: | ||
System.out.println(" Invalid command, please try again"); | ||
return; | ||
} |
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.
Perhaps you can make this block of code separate from the few lines above it?
src/main/java/Duke.java
Outdated
TaskManager taskManager = new TaskManager(); | ||
Scanner scanner = new Scanner(System.in); | ||
Ui ui = new Ui(taskManager, scanner); | ||
ui.start(); |
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 how you created a taskManager class to handle the commands and an Ui class to handle all the output, making the code very easy to understand.
src/main/java/Task.java
Outdated
public String getStatusIcon() { | ||
return (isDone ? "[X]" : "[ ]"); | ||
} | ||
public String getIcon() { | ||
return ""; | ||
} | ||
public String getTiming() { | ||
return ""; | ||
} |
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.
Maybe it would be cleaner to add a new line between each function?
src/main/java/TaskManager.java
Outdated
String taskType = getCommand(task); | ||
Task newTask; | ||
String description = getDescription(task); | ||
switch(taskType) { |
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 how you named the variables, very intuitive and easy to understand.
src/main/java/Ui.java
Outdated
System.out.print(lineBreak); | ||
} | ||
} | ||
} |
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 I really like how you have broken down everything into classes. I think it is very good OOP. Perhaps add some javadocs to explain some of the methods?
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.
Generally well done, keep up the good work!
Added some comments as room for improvements.
src/main/java/duke/command/Ui.java
Outdated
private static void saveData() { | ||
try { | ||
String pathName = PATH_NAME; | ||
//create folder with file if absent initially |
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.
Consider adding a line spacing before a comment for improved readability.
src/main/java/duke/data/Storage.java
Outdated
|
||
while (scanner.hasNext()) { | ||
String line = scanner.nextLine(); | ||
String[] array = line.split(" | "); |
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.
Might want to improve on the name for "array" to make it more meaningful.
String timing = task.getTime(); | ||
|
||
textToAppend = taskType + " | " + status + " | " + description; | ||
if (task instanceof Event || task instanceof Deadline) { |
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.
Avoid complicated expressions, is there any way you can extract it out or make this more streamlined? (hint: use booleans)
# Conflicts: # src/main/java/duke/task/Event.java # src/main/java/duke/task/Task.java # src/main/java/duke/task/TaskManager.java
Add JavaDocs
No description provided.