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

[Chu Yi-Ting] iP #426

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

Conversation

chuyiting
Copy link

No description provided.

Classes related to Duke do not meet the coding standard.

A package named Duke is created to refactor the classes.

Classes related to Duke should all be packaged into a single package, by
doing so, classes related to Duke is encapsulated.

Refer to Package tutorial on GeeksForGeeks
https://www.geeksforgeeks.org/packages-in-java/
Use a csv file as database.
Define standard format for Date.
Scalability of the program was not good because of the weak abstraction
design.

Refactor i/o related classes into ui package, encapsulate data storage
and decrease the dependency between each classes.
# Conflicts:
#	src/main/java/duke/DukeCommandMatcher.java
#	src/main/java/duke/tasks/SingletonTaskList.java
#	src/main/java/duke/utils/Constants.java
#	src/main/java/duke/utils/UtilFunction.java
Build Jar file
Copy link

@bchenghi bchenghi left a comment

Choose a reason for hiding this comment

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

LGTM! Overall, I thought the coding standard was really good! There were no arrow heads and the code was easy to read. I have some minor suggestions, but other than that, I feel that it's good.

}


public String matchCommand(String command) throws CommandNotFoundException, NullCommandException,

Choose a reason for hiding this comment

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

This method might be a little long?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, it does not look nice, but because of the same behaviour that Duke would respond to all these exceptions, I decide to throw all of them and handle it together in the highest level. Thanks for the suggestion.

* @throws IllegalStateException
* @see IllegalStateException
*/
public static void loop(Storage database) throws IllegalStateException {

Choose a reason for hiding this comment

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

loop as a method name, could it be a little vague?

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, as I imagine a working application is something that is looping all the time until you shut it down. Any better suggestions for the name>

src/main/java/duke/utils/Constants.java Show resolved Hide resolved
* Real all the tasks from the database.
* @return the list of all the tasks from the database
*/
public List<Task> readAll() {

Choose a reason for hiding this comment

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

Method name might be a little vague? Since the method returns a list.

Copy link
Author

Choose a reason for hiding this comment

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

Hmm, yeah, I kind of follow the idea of CRUD (the read), as this method scans through the database, therefore I name it readAll. Any suggestions?

}
}

private static void lineSentence(String sentence) {

Choose a reason for hiding this comment

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

Perhaps method names can be verbs or actions?

Copy link
Author

Choose a reason for hiding this comment

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

Hahaha, I spent few minutes pondering on the name of this method, as what it does is basically "auto-change-line" if the sentence is longer than the console (the same as wrapText). I did not know how to name it at that time, I guess ill follow the JavaFX convention. thanks for the suggestion

Copy link

@WhiteLio WhiteLio left a comment

Choose a reason for hiding this comment

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

looks great! keep it up :)

src/main/java/duke/DukeCommandMatcher.java Outdated Show resolved Hide resolved
Comment on lines 45 to 51
* @throws CommandNotFoundException
* @throws NullCommandException
* @throws LackOfTimeException
* @throws NullCommandContentException
* @throws TaskOutOfBoundException
* @throws TaskNotSpecifyException
* @throws DateFormatException
Copy link

Choose a reason for hiding this comment

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

you should specify when these exceptions are thrown!
eg @throws CommandNotFoundException If the user command is not in the command list

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 remind, I forgot to leave a readable note for them. Will add soon.

}

private String handleExit() {
System.out.println("Farewell/再見/さようなら~~");
Copy link

Choose a reason for hiding this comment

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

귀여워요 haha

Copy link
Author

Choose a reason for hiding this comment

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

Good suggestion haha

Comment on lines +109 to +126
switch (taskStr[0]) {
case "T": {
task = new ToDo(taskStr[2], taskStr[1]);
break;
}
case "E": {
task = new Event(taskStr[1], taskStr[2], taskStr[3]);
break;
}
case "D": {
task = new Deadline(taskStr[1], taskStr[2], taskStr[3]);
break;
}
default: {
task = null;
break;
}
}
Copy link

Choose a reason for hiding this comment

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

those curly braces are unnecessary! i think the code would look cleaner without them~

/**
* Exit pattern of the exit command for Duke.
*/
public static final String EXITPATTERN = ("^(b|B)(y|Y)(e|E)$");
Copy link

Choose a reason for hiding this comment

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

you should use underscores to separate words! also, associated constants (final variables) should be prefixed by a common type name
eg PATTERN_EXIT, PATTERN_DONE

Copy link
Author

Choose a reason for hiding this comment

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

Ahh, right, that is a part of the coding standard, I forgot about it, yeah, maybe I'll also consider changing it into an Enum class, thanks.

Copy link

@hyngkng hyngkng 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 like your coding style and your code generally follows the coding standard. Just some nits to fix!

private String duration;

/**
* Default constructor for a new event object.
Copy link

Choose a reason for hiding this comment

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

Shouldn't there be a space between the description and param section?

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