-
Notifications
You must be signed in to change notification settings - Fork 364
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
[Irminrics] iP #12
base: master
Are you sure you want to change the base?
[Irminrics] iP #12
Conversation
Details: Dude is using LocalDateTime for task details
Details: Added validation to Dude's deletion task
Conflicts to be resolved in the next commit: Event.java, Dude.java
He is now lacking validations for commands and will be fixed soon.
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.
Overall, super clean code and easy-to-understand code! Basically, no coding standard violations from what I see.😄
public enum CommandType { | ||
LIST, MARK, UNMARK, TODO, DEADLINE, EVENT, DELETE, FIND, BYE | ||
} |
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.
I like how you used enums to ensure type safety of the commands.
* @param command Command input provided by user. | ||
* @throws DudeException If command is not valid. | ||
*/ | ||
public static void validate(CommandType commandType, String command) throws DudeException { |
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.
I think this is a smart way to handle the input exceptions!
src/main/java/dude/Dude.java
Outdated
/** | ||
* Runs Dude program. | ||
*/ |
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.
I feel like this could be a bit more descriptive.
/** | ||
* Handles the entire dude program | ||
*/ | ||
public class Dude { |
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.
Clean and easy to understand!
Dude has no assertions Assertions are used to define assumptions about the program state so that the runtime can verify them. Let's add assertions to check for functions preconditions/parameter This ensures that the inputs for functions are validated and ensured for correctness
Add assertions
Dude has no usage of guard clause Guard clause helps to keep the main/happy path unindented Let's add guard clause to the execute function in MarkCommand and UnmarkCommand This deals with unusual conditions as soon as they are detected so that the reader does not have to remember them for long
Improve Code Quality
Users of Dude are unable to undo their previous command. This is a quality of life feature which allows them to undo mistakes. Let's add a feature which saves the previous state of task list for the users to undo upon a new command.
Add undo feature
…d Unmark commands
Dude
Dude frees your mind of having to remember things you need to do. It's,
All you need to do is,
And it is FREE!
Features:
If you are a Java programmer, you can use it to practice Java too. Here's the
main
method: