Skip to content

[Toh Zhen Yu, Nicholas] iP#457

Open
nicktohzyu wants to merge 52 commits into
nus-cs2103-AY2021S1:masterfrom
nicktohzyu:master
Open

[Toh Zhen Yu, Nicholas] iP#457
nicktohzyu wants to merge 52 commits into
nus-cs2103-AY2021S1:masterfrom
nicktohzyu:master

Conversation

@nicktohzyu

Copy link
Copy Markdown

No description provided.

damithc and others added 30 commits July 23, 2020 23:27
todo/deadline/event commands and classes
had to compile in java 8 due to runtime environment on local
fix indexing bug
abstract number of tasks message
delete command
using java serialization
needs work handling non existant directories
refactor input/output and messages into UI
not necessary for tasks to have a storage object
add private constructor
remove unused store method
Empty commit: project already follows a coding standard
add find command
Add javadoc for find
Refactor print_tasks to use UI

@Door-oof Door-oof 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.

Overall, I find your code readable. However, there are some coding standards violations that needs to be fixed. Nevertheless, a good job.

Comment thread src/main/java/Parser.java
String[] subst;
LocalDate date;
switch (command) {
case "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.

This is incorrect because there should not be any indentation for the case clauses.

Comment thread src/main/java/Deadline.java Outdated
public class Deadline extends Task {

/**
* @param description Task description

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There should be a punctuation behind every parameter description. I have noticed similar issue in other places too.

Comment thread src/test/java/TaskTest.java Outdated
@Test
public void dummyTest(){
Task t = new Task("test1", LocalDate.parse("2001-09-11"));
// System.out.println(t.toString());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is incorrect as comments should be indented relative to their position in the code.

Comment thread src/main/java/Duke.java
@@ -1,10 +1,34 @@
/**

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 putting the class in a package?

Comment thread src/main/java/Storage.java Outdated
@@ -0,0 +1,55 @@
import java.io.*;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The imported classes should be listed explicitly.

Comment thread src/main/java/Task.java Outdated
*/
public class Task implements java.io.Serializable {
String text;
boolean done;

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 a more intuitive variable name that will sound more like a boolean?

Comment thread src/main/java/Duke.java

/**
* Entry point of the duke program. Read from storage and creates a UI class instance.
* Serves as intermediate between the UI and parser.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is incorrect as there should be an empty line between the description and parameter. I have noticed similar issues in several other places too.

*/
public class Deadline extends 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.

Perhaps adding a short summary of the method? This can also apply to other methods that do not have a description in other places.

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, not sure how I should describe the constructor or toString, do you have suggestions?

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

All in all, the code was easy to read and understand. There was no deep nesting done, and the code was not complicated. The names of the variables made sense in accordance to the methods. However, some form of packaging can be done to make the organisation of the code cleaner!

@JinHao-L JinHao-L 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.

Your code is quite neat and easy to follow. There is no overly complicated code that needs abstraction. I agree with most of the changes suggested by Door-oof and suggested some minor violations that he might have missed out.

Besides packaging, I also recommend considering the usage of public vs protected access modifiers as I noticed that public is used for certain methods while protected is used for others, even though both methods should have the same accessibility level.

Overall, it's quite a good piece of work and a pleasure to read.

Comment thread src/main/java/Parser.java
Comment on lines +32 to +33
case "done":
case "delete":

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The "done" case should end with a break; statement. You might have unintentionally shifted the "done" case into the "delete" case.

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.

Hi, this was intentional as both commands use the same logic of tokenizing the input to get the task number, then getting that task object. It is after these steps where the logic then differs. Do you have a suggestion of a better way to do this?

Comment thread src/main/java/Parser.java Outdated
break;
default:
throw new DukeException("I'm sorry, but I don't know what that means :-(");
// break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

A break statement should be included for the default case too.

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.

Hmm intellij complains about this as it's an unreachable statement. Do you know how I can configure it to ignore this error, or have a suggestion on how to implement this logic instead?

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