Skip to content

[Huang Maodian] iP#190

Open
Geinzit wants to merge 28 commits into
nus-cs2113-AY2324S2:masterfrom
Geinzit:master
Open

[Huang Maodian] iP#190
Geinzit wants to merge 28 commits into
nus-cs2113-AY2324S2:masterfrom
Geinzit:master

Conversation

@Geinzit

@Geinzit Geinzit commented Feb 8, 2024

Copy link
Copy Markdown

No description provided.

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

Generally ok, but try to be more careful with magic number and string. Avoid long and complicated function/statement.

Comment thread src/main/java/huan/main/Huan.java Outdated
@@ -0,0 +1,142 @@
package huan.main;

import huan.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.

Avoid importing *, try to explicitly list out the import classes

Comment thread src/main/java/huan/main/Huan.java Outdated
}
}
}
public static void readProcessCommand() {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Very long method, maybe try to abstract each command?

Comment thread src/main/java/huan/main/Huan.java Outdated
String firstWord = words[0];
String suffixWord;
if(words.length > 1) {
suffixWord = inputCommand.substring(words[0].length() + 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.

Multiple usage of Magic numbers, try to assign the number with a meaningful variable name for easy understand of what the number is for.

String[] words = nameWithDate.split(" ");
/*
state:
0 means currently concatenating name

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 using ENUM instead of 0,1 for the state

import java.util.Objects;

public class DeadlineTask extends Task{
private String ddlTime;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

maybe can consider calling it deadlineTime, as ddlTime can be hard to understand what it means

Comment thread src/main/java/huan/task/EventTask.java Outdated
}
}
}
if(state != 2 || name.toString().isEmpty() || startTime.toString().isEmpty() || endTime.toString().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.

very long and complicated statement, can consider splitting it up

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.

2 participants