Skip to content

[Izdiyad] iP - #184

Open
izdiyadfrhn wants to merge 30 commits into
nus-cs2113-AY2122S1:masterfrom
izdiyadfrhn:master
Open

[Izdiyad] iP#184
izdiyadfrhn wants to merge 30 commits into
nus-cs2113-AY2122S1:masterfrom
izdiyadfrhn:master

Conversation

@izdiyadfrhn

Copy link
Copy Markdown

No description provided.

@daknam2001 daknam2001 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.

good job with following coding standards overall!

public class Deadline extends Task {
protected String by;

public Deadline(String description, String by) {

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 done with naming classes in PascalCase

Comment thread src/main/java/Duke.java Outdated
private static int taskCount;

// prints a string within two horizontal lines, @param is string to be printed
public static void printWithLines(String text) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job with writing method names in camelCase

Comment thread src/main/java/Duke.java Outdated
String inputCommand = input.trim().split(" ")[0];
String inputData = input.replaceFirst(inputCommand, "").trim();

switch (inputCommand){

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

good job with the indentation of switch cases

Comment thread src/main/java/Duke.java Outdated
taskCount++;
}

public static void listTasks() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

egyptian style brackets used, well done!

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

public static void addTask(String task) {

if (task.startsWith("todo")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

curly braces used for all if-else statements, well done

Comment thread src/main/java/Duke.java Outdated
public class Duke {
public static void main(String[] args) {
private static Task[] tasks;
private static int taskCount;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

variable names are in camelCase, nice job

Comment thread src/main/java/Duke.java Outdated
printWithLines(byeMessage);
}

public static void addTask(String task) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add comments on how the method works and explain the parameters

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

public static void addTask(String task) {

if (task.startsWith("todo")) {

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 think can work on the readability of the code by creating a method for each else if statement.

Comment thread src/main/java/Duke.java Outdated
+ chosenTask.description);
}

public static void selectCommand(String input) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recommend to refractor code to include a task manager to handle all the task events instead of all in duke.java

Comment thread src/main/java/Task.java Outdated
protected String description;
protected boolean isDone;

public Task(String description) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good to include comments to explain what Task is

@Samuel787 Samuel787 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.

Your code follows good OOP structure. Good code style and quality is mostly observed. LGTM! Good job!

Comment thread src/main/java/duke/Duke.java Outdated
ui.printWithLines(e.getMessage());
}

// Gets the next command entered

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code is well structured and easy to understand what the code is doing here. Hence, this comment seems redundant. You may want to consider removing it :)

Comment thread src/main/java/duke/Parser.java Outdated
public Command addTask(String input) throws DukeException {

if (input.startsWith(TODO)) {
if (input.substring(4).isEmpty()) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

4 seems to be a Magic Number

Comment thread src/main/java/duke/Parser.java Outdated
trimInput(input);

} else if (input.startsWith(DEADLINE)) {
if (!input.contains("/by")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can also consider making "/by" a constant just like DEADLINE

Comment thread src/main/java/duke/Parser.java Outdated
Command commandFromInput = null;

switch (trimmedInput){
case TODO: case DEADLINE: case EVENT:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When you have multiple cases and you want the control to cascade down, you can still follow the same recommended code style to have each case in a new line.

Comment thread src/main/java/duke/command/Command.java Outdated

protected Ui ui;
protected TaskList tasks;
private int targetIndex = -1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This private variable is declared in this abstract class but not used. Do you need this variable?

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