-
Notifications
You must be signed in to change notification settings - Fork 73
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
[Hao Yun]iP #53
base: master
Are you sure you want to change the base?
[Hao Yun]iP #53
Conversation
Add toolVersion block in to Gradle code sample to prevent errors.
Change file mode on `gradle` to be executable (nus-cs2113-AY1920S2#9)
Gradle defaults to an empty stdin which results in runtime exceptions when attempting to read from `System.in`. Let's add some sensible defaults for students who may still need to work with the standard input stream.
Add configuration for console applications
The OpenJFX plugin expects applications to be modular and bundled with jlink, resulting in fat jars that are not cross-platform. Let's manually include the required dependencies so that shadow can package them properly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally, your code is easy to read for the most part. Perhaps you can be more careful with the naming of the methods to prevent confusion. We hope that our comments can help you to enhance your code further.
All the best for your iP :D
[Also took part in this review: @kcubey]
src/main/java/Duke.java
Outdated
System.out.println("------------------------------------"); | ||
System.out.println(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
String logo = " ____ _ \n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you may want to consider putting the logo and the print statements into another method to better implement the SLAP principle such as the greet() method.
src/main/java/TaskManager.java
Outdated
System.out.println("------------------------------------"); | ||
System.out.println("Here is the list of all tasks you have:"); | ||
for(int i = 0; i < numOfTasks; i++) { | ||
System.out.println(String.format("%d.[%c] %s", i+1,(tasks[i].isDone? '✓':'✗'), tasks[i].name)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to consider seperating this statement into a few more lines to make the code more readable. For example, you may want to first create variables for each item in the print function:
String isDone = tasks[i].isDone? '✓':'✗';
src/main/java/Duke.java
Outdated
} else if (command.equals("list")){ | ||
manager.listTask(); | ||
} else if (command.startsWith("done")){ | ||
manager.markTask(Integer.parseInt(command.substring(5))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to consider creating a constant for the number 5 here. Creating a constant can help to give more meaning to the number written here.
Reference Link: Magic Number
Alternatively, you may want to consider changing this line to be more descriptive to avoid confusion, such as
int taskNum = Integer.parseInt(command.substring(5)), or adding a comment to make it clearer what this does, like //command syntax: done 6
src/main/java/Duke.java
Outdated
|
||
private TaskManager manager = new TaskManager(); | ||
|
||
public void exit() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to consider changing the name of this method to make it more descriptive, as it could be confused for System.exit()
src/main/java/Duke.java
Outdated
System.out.println(); | ||
} | ||
|
||
public void run() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, you could consider renaming this method to be more descriptive, as it could be confused for the Java Thread run() method
src/main/java/TaskManager.java
Outdated
public void markTask(int taskNo) { | ||
System.out.println("------------------------------------"); | ||
System.out.println("Good job! You have done this task:"); | ||
System.out.println(" [✓] " + tasks[taskNo-1].name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to consider changing this whitespace to \t, to standardise any future tabbed spaces and to reduce confusion for future implementation by other viewers
merge gradle to master
# Conflicts: # src/main/java/duke/Ui.java
Branch a java doc
No description provided.