-
Notifications
You must be signed in to change notification settings - Fork 438
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
[Yan Lyn] iP #469
base: master
Are you sure you want to change the base?
[Yan Lyn] iP #469
Conversation
This reverts commit 652a853.
This reverts commit 2c4ba83.
This reverts commit 6f3abf9.
# Conflicts: # src/main/java/Duke.java
* branch-Level-8: Level 8
* branch-Level-7: no message Level 8 Level 7 # Conflicts: # listStore.ser # src/main/java/Duke.java
This reverts commit 49a8bb8.
* branch-A-CodingStandard: A-CodingStandard # Conflicts: # src/main/java/Duke.java
* branch-Level-9: Level-9 # Conflicts: # src/main/java/Duke.java
* commit 'a75fceeb74708da6ac524c08ef526d38e60ee56b': build.gradle: Update version to 8.29 Add Gradle support
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 pretty good!
However one important thing to note is that, I realized that all classes were nested inside the Duke class which could get clunky and messy as the project gets bigger. You should try to distribute and package each class separately to make it neater. Also, I realized that most if not all the classes are static as well which should be removed they are redundant to the class.
For the JavaDocs, just do not forget about the fullstops!
public class Duke { | ||
|
||
private static Storage storage; | ||
private TaskList inputs; |
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.
Could the name "inputs" be a little more precise when it comes to referring a TaskList?
@@ -7,12 +7,18 @@ | |||
import java.time.format.DateTimeFormatter; | |||
import java.time.temporal.ChronoUnit; | |||
|
|||
|
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.
Do you think adding a JavaDoc description here would allow other users to better understand what exactly Duke does?
src/main/java/Duke.java
Outdated
|
||
|
||
/* | ||
* Constructs Duke Object, constructs UI, storage and TaskList object to initialize |
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.
Missing full stop for JavaDoc here!
} | ||
|
||
// Input class represents user inputted tasks | ||
public static class Input implements Serializable { |
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 use of static classes and interfaces here!
src/main/java/Duke.java
Outdated
|
||
// Input class represents user inputted tasks | ||
public static class Input implements Serializable { | ||
boolean done; |
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.
You could try naming this boolean more like a boolean, something like isDone.
} | ||
Todo todo = new Todo(nextLine.substring(5)); |
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 realised the use of substring to get specific keywords from the user input. An alternative to this would be to use the split() function of String to split the user input up!
int len = inputs.size(); | ||
for(int i = 0; i < len; i++) { | ||
Input input = inputs.get(i); | ||
if (input.content.contains(keyword)) { |
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 you can consider making this more succint. In other words, try to avoid nesting conditionals which could get quite messy, though I am guilty of this too!
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.
Would the code more readable if you use extra method to handle the conditions? 🤔
src/main/java/Duke.java
Outdated
|
||
//Parser class deals with making sense of user command | ||
public static class Parser { | ||
String nextLine; |
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.
Are these missing their access modifiers? It would be best to make them private!
src/main/java/Duke.java
Outdated
inputs.taskEvent(nextLine); | ||
} else if (nextLine.startsWith("find")) { | ||
inputs.taskFind(nextLine); | ||
} else if (nextLine.equals("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.
You could try making these code more succint by nesting lesser conditionals together!
src/main/java/Duke.java
Outdated
System.out.println("Noted. I've removed this task:"); | ||
Input inputType = inputs.get(numTaskDone - 1); | ||
if (inputType.done) { | ||
System.out.println(" " + inputType.id + "[/] " + inputType.content + inputType.printTime); |
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.
You could try using the tick symbol instead of a '/'. The four-digit hex code for the tick symbol is \u2713.
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.
Just some nits to fix for more readability.
src/main/java/Duke.java
Outdated
* @param nextLine, represents user input | ||
* @throws DukeException if user does not specify which task done, or if task specified is not in list | ||
*/ | ||
void taskDone(String nextLine) 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.
I notice you are trying to mark a task as done. Would it be better if you rename your method to verb? For example, markTaskDone.
} | ||
} | ||
|
||
public static void main (String[]args) 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.
Is there any spacing errors?
String content; | ||
String id; | ||
LocalDate time; | ||
String printTime; |
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.
Is it better to understand a variable or method if you use noun for variable/class and verb for methods/functions?
🤔
this.id = "[E]"; | ||
this.printTime = "(" + time.format(DateTimeFormatter.ofPattern("MMM d yyyy")) + ")"; | ||
} | ||
} |
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 am glad that all of your code is maintained below the line length limit which is below 120 char, so the code view is better. 👍
src/main/java/Duke.java
Outdated
inputs.add(deadline); | ||
int count = inputs.size(); | ||
System.out.println("Got it. I've added this task: \n" + " [D][x] " + deadline.content + | ||
deadline.printTime + "\n Now you have " + count + " 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.
Would the readability improve if you break the line before operator? 🤔
int len = inputs.size(); | ||
for(int i = 0; i < len; i++) { | ||
Input input = inputs.get(i); | ||
if (input.content.contains(keyword)) { |
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.
Would the code more readable if you use extra method to handle the conditions? 🤔
This reverts commit 311532c.
* branch-A-CodeQuality: A-CodeQuality
No description provided.