Skip to content
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

Open
wants to merge 47 commits into
base: master
Choose a base branch
from
Open

Conversation

yanlynnnnn
Copy link

No description provided.

damithc and others added 30 commits July 23, 2020 23:27
This reverts commit 652a853.
# Conflicts:
#	src/main/java/Duke.java
* 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
Copy link

@hogantan hogantan left a 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;

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;


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?



/*
* Constructs Duke Object, constructs UI, storage and TaskList object to initialize

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 {

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!


// Input class represents user inputted tasks
public static class Input implements Serializable {
boolean done;

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));

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)) {

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!

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? 🤔


//Parser class deals with making sense of user command
public static class Parser {
String nextLine;

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!

inputs.taskEvent(nextLine);
} else if (nextLine.startsWith("find")) {
inputs.taskFind(nextLine);
} else if (nextLine.equals("list")) {

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!

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);

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.

Copy link

@tanwayne890 tanwayne890 left a 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.

* @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 {

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 {

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;

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")) + ")";
}
}

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. 👍

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");

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)) {

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? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants