Skip to content

[FeathersRe] iP#189

Open
FeathersRe wants to merge 40 commits into
nus-cs2113-AY2324S2:masterfrom
FeathersRe:master
Open

[FeathersRe] iP#189
FeathersRe wants to merge 40 commits into
nus-cs2113-AY2324S2:masterfrom
FeathersRe:master

Conversation

@FeathersRe

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Daisy.java

Scanner in = new Scanner(System.in);
String command = in.nextLine();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps its a good idea to use SLAP here! Since your Main is more than 30 LoC, readability maybe affected.

Comment thread src/main/java/Task.java Outdated
isDone = false;
}

public String toString() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this expression can be stored in a variable? This will help you avoid complicated expressions

Comment thread src/main/java/Daisy.java
import java.util.Scanner;

public class Daisy {
public static void main(String[] args) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like you named these literals. This improves the readability of your code as you're removing redundant lines

Comment thread src/main/java/Daisy.java Outdated
final String INTRO_PROMPT = "Good day! This is Daisy.\nAny task for today?";
final String EXIT_PROMPT = "Ending prompt received. Remember to keep to the deadlines!";
final String LINE_BREAK = "____________________________________";
Task[] tasks = new Task[100];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhap this magic number can be avoided? Using a named constant (Like you did for your literal above) will allow others to understand the meaning of this number.

@wwweert123 wwweert123 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well organized code which follows coding standards and code quality practices, can consider adding more OOP

Comment thread src/main/java/Daisy.java Outdated

loadData();

System.out.println(LINE_BREAK);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider more SLAP here, eg printIntro()

Comment thread src/main/java/Daisy.java
Scanner in = new Scanner(System.in);
String command = in.nextLine();

while (!command.equals("bye")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider abstracting this to parser class in the future

Comment thread src/main/java/Daisy.java Outdated
String[] separate_commands = command.split(" ",2);
switch (separate_commands[0]) {
case "list":
for (Task task : tasks) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider more SLAP, printAllTasks()

Comment thread src/main/java/Daisy.java
System.out.println("Congrats on completing the task!");
System.out.println(tasks.get(Integer.parseInt(separate_commands[1])-1));
break;
case "unmark":

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can define all constants at the top for all command strings to prevent using magic literals

Comment thread src/main/java/Daisy.java Outdated
}
}

public static void createTodo(String taskName, boolean printOut, boolean setDone) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider creating a command abstract task and subclasses such as AddCommand for creating tasks

Comment thread src/main/java/Daisy.java Outdated
addItem(newEvent, printOut);
}

public static void loadData() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can consider having a storage class for loading and storing to file

@@ -0,0 +1,4 @@
package daisy.error;

public class IllegalDeadlineFormatException extends Exception{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can create specific methods in the exception that print specific error messages, exceptions act just like classes

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