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

[rohitcube] iP #86

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

Conversation

rohitcube
Copy link

No description provided.

Copy link

@onx001 onx001 left a comment

Choose a reason for hiding this comment

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

I like the naming conventions used, they were clear and concise. Any reason why you chose to omit javadocs and whitespaces?

Comment on lines 9 to 20
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
String line = "------------------------";

System.out.println(logo);
System.out.println("User");
System.out.println("ToDos: tasks without any date/time attached to it e.g., visit new theme park");
System.out.println("Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm");
System.out.println("Events: tasks that start at a specific date/time and ends at a specific date/time");
Copy link

Choose a reason for hiding this comment

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

Consider incorporating these lines with the logo to avoid repeating "System.out.println".

Comment on lines 42 to 49
String[] parts = userInput.split("/by");
String description = parts[0].substring(9).trim();
String by = parts[1].trim();
tasks.add(new Deadline(description, by));
System.out.println(line);
System.out.println("Got it. I've added this task:");
System.out.println(" " + tasks.get(tasks.size() - 1));
System.out.println("Now you have " + tasks.size() + " tasks in the list.");
Copy link

Choose a reason for hiding this comment

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

Consider adding whitespaces to improve readability.

System.out.println(logo);
System.out.println("User");
System.out.println("ToDos: tasks without any date/time attached to it e.g., visit new theme park");
System.out.println("Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm");
Copy link

Choose a reason for hiding this comment

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

Consider splitting this line into shorter chunks.

Comment on lines 71 to 87
} else if (userInput.startsWith("unmark ")) {
int taskIndex = Integer.parseInt(userInput.split(" ")[1]) - 1;
if (taskIndex >= 0 && taskIndex < tasks.size()) {
tasks.get(taskIndex).markAsNotDone();
System.out.println(line);
System.out.println("OK, I've marked this task as not done yet:");
System.out.println(" " + tasks.get(taskIndex));
} else {
System.out.println(line);
System.out.println("Invalid task index.");
}
} else {
tasks.add(new Todo(userInput));
System.out.println(line);
System.out.println("added: " + userInput);
}

Copy link

Choose a reason for hiding this comment

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

Any reason why you chose nested loops?

Comment on lines 60 to 69
} else if (userInput.startsWith("mark ")) {
int taskIndex = Integer.parseInt(userInput.split(" ")[1]) - 1;
if (taskIndex >= 0 && taskIndex < tasks.size()) {
tasks.get(taskIndex).markAsDone();
System.out.println(line);
System.out.println("Nice! I've marked this task as done:");
System.out.println(" " + tasks.get(taskIndex));
} else {
System.out.println(line);
System.out.println("Invalid task index.");
Copy link

Choose a reason for hiding this comment

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

Try to avoid arrowhead style convention. Perhaps you could have the marking and unmarking of task as a separate method.

}
}

class Task {
Copy link

Choose a reason for hiding this comment

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

You should probably store the different classes in different files

import java.util.Scanner;

public class Dukey {
public static void main(String[] args) {
Copy link

Choose a reason for hiding this comment

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

Avoid long methods - could consider having different methods outside of the main method

Copy link

@YongbinWang YongbinWang left a comment

Choose a reason for hiding this comment

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

Overall good job so far. Some minor coding standard nitpicks from me. Good naming of variables and code quality. Keep up the good work!

Comment on lines 3 to 4
import Tasks.*;
import dukey.*;

Choose a reason for hiding this comment

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

Imported classes should always be listed explicitly.

tasks.add(new Todo(description));
tasks.get(tasks.size() - 1).printNewTask();
} catch(IndexOutOfBoundsException e) {
System.out.println("_____________________________________________________");

Choose a reason for hiding this comment

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

Consider abstracting this out into a constant variable called LINE_DIVIDER.

public static void main(String[] args) {
System.out.println("Hey! I'm Dukey, your virtual assistant!\nWhat can I do for you?\n");
Scanner in = new Scanner(System.in);
String line;

Choose a reason for hiding this comment

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

Consider changing the variable name to something more appropriate such as userInput.

Comment on lines 87 to 88
switch (firstWord) {
case "bye":

Choose a reason for hiding this comment

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

Take note of the coding standard violation here, the case clause should not have an indentation. You can change your IDE to follow the coding standard.

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.

4 participants