Skip to content

[Huang Maodian] iP#190

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

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

Conversation

@Geinzit
Copy link

@Geinzit Geinzit commented Feb 8, 2024

No description provided.

Copy link

@ChoonSiang ChoonSiang left a comment

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.

@@ -0,0 +1,142 @@
package huan.main;

import huan.task.*;

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

}
}
}
public static void readProcessCommand() {

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?

String firstWord = words[0];
String suffixWord;
if(words.length > 1) {
suffixWord = inputCommand.substring(words[0].length() + 1);

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

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;

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

}
}
}
if(state != 2 || name.toString().isEmpty() || startTime.toString().isEmpty() || endTime.toString().isEmpty()) {

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