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

[Dexter Hoon] iP #68

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

Conversation

DextheChik3n
Copy link

No description provided.

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

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

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
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

src/main/java/Task.java Outdated Show resolved Hide resolved

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() + "] " +

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
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

src/main/java/Alan.java Outdated Show resolved Hide resolved
Copy link
Member

@skylee03 skylee03 left a comment

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 on lines 56 to 57
System.out.println("\t[" + tasks[Integer.parseInt(words[1])].getStatusIcon() + "] " +
tasks[Integer.parseInt(words[1])].getDescription());
Copy link
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
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

System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
}

public static void main(String[] args) {
Copy link
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
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

src/main/java/Alan.java Outdated Show resolved Hide resolved
src/main/java/Alan.java Outdated Show resolved Hide resolved
Copy link

@woowenjun99 woowenjun99 left a comment

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 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.");
}

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)?

this.description = description;
}

public boolean getDone() {

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