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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wongyx] iP #112

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

[wongyx] iP #112

wants to merge 34 commits into from

Conversation

wongyx
Copy link

@wongyx wongyx commented Jan 23, 2023

Duke

Duke helps you to keep track of upcoming tasks that you might have. It's

  • text-based
  • easy VERY EASY to use

You just need to

  1. Download it from here
  2. Run the ip.jar file
  3. Add some task in
  4. Let Duke keep track of all your task easily

And it is FREE

Features include:

  • Managing tasks
  • Reminders (coming soon) 馃毀

Here's the main method of Duke:

public static void main(String[] args) {
    new Duke("data/tasks.txt").run();
}

wongyx and others added 14 commits January 24, 2023 18:30
This file contains backend data for the program

Files containing backend data should not be on the repo, hence it is deleted
Most of the code is written under main.

Extracting closely related code into classes and placing them
into packages improves the code quality.

Let's create multiple classes to deal with related parts of the
code and package them together.
Mark, Unmark and Delete Commands do not save after execution.

This commits fixes these issues.
Copy link

@glozxi glozxi left a comment

Choose a reason for hiding this comment

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

Maybe change code to follow the coding standard, but overall I like it.

throws TaskNoDescriptionException, NotEnoughArgumentsException, DateTimeParseException {
String info = fullCommand.substring(8).trim();
if (info.isEmpty()) {
throw(new TaskNoDescriptionException("OOPS!!! The description of a deadline cannot be empty."));
Copy link

Choose a reason for hiding this comment

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

I have noticed that you put parentheses around new thrown exceptions. I don't think that is against the coding standards, but perhaps leave a space between throw and (. This is because throw is a Java reserved word, so should be followed by a white space.

public static Command parse(String fullCommand) {
String[] commandParts = fullCommand.split(" ", 2);
String commandHeader = commandParts[0];
switch (commandHeader) {
Copy link

Choose a reason for hiding this comment

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

You might want to unindent switch cases.

@@ -0,0 +1,28 @@
package duke.commands;

/** This is a command to add a task to Duke
Copy link

Choose a reason for hiding this comment

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

Can put /** on separate line

import java.time.format.DateTimeParseException;

/**
* This is a class responsible for parsing the inputs given by user
Copy link

Choose a reason for hiding this comment

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

Perhaps put punctuation behind each parameter description. I have noticed this in other places too.

public Event(String description, LocalDate from, LocalDate to, boolean isDone) {
super(description, isDone);
this.from = from;
this.to= to;
Copy link

Choose a reason for hiding this comment

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

Maybe a space around the =?

public abstract boolean isExit();

public abstract String execute(TaskList taskList, Ui ui, Storage storage);
}
Copy link

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 OOP for the commands.

public static Command parse(String fullCommand) {
String[] commandParts = fullCommand.split(" ", 2);
String commandHeader = commandParts[0];
switch (commandHeader) {
Copy link

Choose a reason for hiding this comment

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

Perhaps you could think about using enums for the command types?

public static Command parse(String fullCommand) {
String[] commandParts = fullCommand.split(" ", 2);
String commandHeader = commandParts[0];
switch (commandHeader) {

Choose a reason for hiding this comment

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

Perhaps you could unindent switch cases?

Command c = Parser.parse("deadline grocery /by 19/10/2023");
LocalDate date = LocalDate.parse("19/10/2023", DateTimeFormatter.ofPattern("d/MM/yyyy"));
AddDeadlineCommand test = new AddDeadlineCommand("grocery", date);
//AddTodoCommand test = new AddTodoCommand("grocery");

Choose a reason for hiding this comment

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

Perhaps unused code can be deleted

}

Todo t = (Todo) o;
if (this.description.equals(t.description)) {

Choose a reason for hiding this comment

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

A minor nit but perhaps this boolean value could be returned directly.

*/
public TaskList(ArrayList<Task> tasks) {
this.tasks = tasks;
this.counter = tasks.size();

Choose a reason for hiding this comment

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

Maybe you could name counter as size for clearer naming?

Code has some parts that does not follow coding standards.

Changing the code to follow coding standards will help improve
readability and quality of the code.
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

3 participants