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

[Toh Zhen Yu, Nicholas] iP #457

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

Conversation

nicktohzyu
Copy link

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

@Door-oof Door-oof left a comment

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.

String[] subst;
LocalDate date;
switch (command) {
case "list":

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.

public class Deadline extends Task {

/**
* @param description Task description

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.

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

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.

@@ -1,10 +1,34 @@
/**

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?

@@ -0,0 +1,55 @@
import java.io.*;

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.

*/
public class Task implements java.io.Serializable {
String text;
boolean done;

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?


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

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 {

/**

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

Copy link

@LimZeWeiDennis LimZeWeiDennis left a comment

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!

Copy link

@JinHao-L JinHao-L left a comment

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 on lines +32 to +33
case "done":
case "delete":
Copy link

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

break;
default:
throw new DukeException("I'm sorry, but I don't know what that means :-(");
// break;
Copy link

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

None yet

4 participants