Skip to content

[Dexter Hoon] iP#68

Open
DextheChik3n wants to merge 56 commits into
nus-cs2113-AY2324S1:masterfrom
DextheChik3n:master
Open

[Dexter Hoon] iP#68
DextheChik3n wants to merge 56 commits into
nus-cs2113-AY2324S1:masterfrom
DextheChik3n:master

Conversation

@DextheChik3n

Copy link
Copy Markdown

No description provided.

@DextheChik3n DextheChik3n changed the title [Dexter] iP [Dexter Hoon] iP Sep 5, 2023
Comment thread src/main/java/Alan.java Outdated
//unmark tasks as undone
String[] words = userInput.split(" ");

tasks[Integer.parseInt(words[1])].setDone(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you rename this line as a variable, seeing as you use it later in your code?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks for the suggestion... I think it could be helpful to do this as it can make my code neater :D

Comment thread src/main/java/Task.java
Comment thread src/main/java/Alan.java Outdated
System.out.println("Ok, I've marked this task as not done yet:");
System.out.println("\t[" + taskList[Integer.parseInt(words[1])].getStatusIcon() + "] " +
taskList[Integer.parseInt(words[1])].getDescription());
System.out.println("\t[" + tasks[Integer.parseInt(words[1])].getStatusIcon() + "] " +

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 making some variables statement could make this less verbose

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I agree... will probably do that since it does look very complex and hard to understand what is going on

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

@skylee03 skylee03 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The code quality is very high!

Comment thread src/main/java/Alan.java Outdated
Comment on lines +56 to +57
System.out.println("\t[" + tasks[Integer.parseInt(words[1])].getStatusIcon() + "] " +
tasks[Integer.parseInt(words[1])].getDescription());

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try to avoid complicated expressions.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah very true... I will follow what someone else suggested by using more variables to simplify the statement

Comment thread src/main/java/Alan.java Outdated
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}

public static void main(String[] args) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Try to avoid long methods. You can try to extract part of the code into other methods.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Alright sure I can try to break the long method into smaller methods to handle each of the commands which can make it easier to debug and organise my code

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

@woowenjun99 woowenjun99 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 on the PR! Here are some feedbacks:

Perhaps you would like to consider reviewing the variable names as I noticed that there was variable shadowing (i.e. currentTasksIndex is used as an attribute name as well as a parameter in the function).

Also, perhaps do you want to consider the standardisation of the use of variables and magic strings? I noticed that you declared variables for the error messages but not for the other messages and hence magic strings still exists.

Do you also want to consider using attributes for the tasks array and user input because it is the class' property and many methods will use them over and over again?

Finally, do you want to relook at the code readability as I noticed that many attributes and methods were not spaced consistently, making it difficult to read. Do you want to have a look at switch case or String.formatf

Comment thread src/main/java/Alan.java Outdated
Comment on lines +31 to +34
public static void printTaskAddedMessage(Task[] tasks, int currentTasksIndex) {
System.out.println("added: " + tasks[currentTasksIndex]);
System.out.println("Now you have " + currentTasksIndex + " in the list.");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do you want to consider changing the variable name for the currentTasksIndex as I noticed that it shares the same name as the class attribute and might be ambiguous (have to be more careful in the future)?

Comment thread src/main/java/Task.java
this.description = description;
}

public boolean getDone() {

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 you would like to use a more boolean name for this method

DextheChik3n and others added 30 commits September 20, 2023 23:55
Add Date parsing for deadline and event tasks
# Conflicts:
#	src/main/java/alan/parser/Parser.java
# Conflicts:
#	src/main/java/alan/parser/Parser.java
# Conflicts:
#	src/main/java/alan/data/exception/AlanException.java
#	src/main/java/alan/parser/Parser.java
#	src/main/java/alan/storage/Storage.java
#	src/main/java/alan/ui/Ui.java
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