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

[Qi Ting] iP #492

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

[Qi Ting] iP #492

wants to merge 45 commits into from

Conversation

nqt230
Copy link

@nqt230 nqt230 commented Aug 28, 2022

Duke prototype 0.2

"By failing to prepare, you are preparing to fail."
– Benjamin Franklin

Features

  • Command Line Text-based with GUI interface
  • Super fast
  • Easy to use 🤔
    • Straightforward text commands to perform all functions
  • Task managing functionality:
    • Supports creation of multiple kinds of tasks
    • Marking of tasks
    • Deletion of tasks
    • Local saving and loading of tasks

Setting up:

  1. Download the latest release from here.
  2. Run the file (double-click duke.jar).
  3. Done! You can start using Duke to manage your tasks.

If you're a Java programmer, you can use it to practice Java too. Here's the main method:

public class Launcher {
    public static void main(String[] args) {
        Application.launch(Main.class, args);
    }
}

Planned features

  • Basic create, update and delete operations for task management.
  • Task filtering and sorting by date.
  • Task tagging.

damithc and others added 11 commits July 31, 2022 17:20
- Add basic greeting and exit phrases
- Implement basic input reading
- Create ParseInput method to parse commands to the bot and call the relevant methods
- Create AddToList and DisplayList methods to support text list feature
> AddToList stores a given text string to a list
> DisplayList prints all the text strings stored so far in order
- Remove unused Echo method from Level-1
- Rework text list feature to a to-do list
> Create Task class to represent tasks that can be added to the to-do list
> Implement methods to support marking of Tasks as completed
- Implement ParseArgs method to support chatbot commands with arguments
- Create Deadline, Event and ToDo classes that inherit from Task to support different types of Task creation
- Refactor input parsing logic to support creation of different types of tasks
- Add test input to input.txt file
- Performed testing using Runtest.bat
- Fix bug where tasks could be created with empty name or date
- Create DukeException class to be thrown by and handled by methods in Duke
- Refactor methods to use DukeException class in error handling
- Implement delete command
> Tasks can now be deleted from the list by index
- Modify test input to test deletion feature
- Chat history with Duke is now saved between runs and loaded on start
- Modify parsing of input to parse date arguments
- Modify Deadline and Event class to store date as LocalDate instead of String
@nqt230 nqt230 marked this pull request as draft August 31, 2022 03:10
- Modify all code to follow coding style
- Refactor task saving logic to be cleaner
- Update javadocs
- Set up gradle
- Create Ui, TaskList, Storage, and Parser classes to handle different operations of Duke
- Refactor code to these new classes
- Packaged all classes into one package Duke
- Added JUnit tests for adding tasks, loading and saving tasks, and parsing input commands
- Added JavaDocs to more methods
- Adjust code to follow coding standard where not done previously
- Add getter for taskName to Task class
- Add search task by taskName functionality to TaskList class
- Modify Parser class to accept search command
- Add display text function for search command to Ui class
- Add checkstyle plugin to gradle
- Use chcekstyle to find coding style violations
- Resolve coding style violations
@nqt230 nqt230 marked this pull request as ready for review September 1, 2022 02:08
- Create GUI for Duke
    - User input is now received from the TextField component in MainWindow
    - handleUserInput function in MainWindow passes the user input to Duke
    - Duke takes the input and passes it to Parser
    - Duke now also stores the response to the user generated by Ui to be displayed by MainWindow
Copy link

@RachelChua RachelChua left a comment

Choose a reason for hiding this comment

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

LGTM! I like your error handling and OOP used! Also, your code follows the java coding standards very well. Good job!

public static Task addEvent(String args) throws DukeException {
String[] argsArr = args.split(" /at ", 2);
if (argsArr.length < 2) {
throw new DukeException("Failed to create event: Invalid number of arguments");

Choose a reason for hiding this comment

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

I like how you handle many different types of errors. Good job on error handling!

Copy link
Author

Choose a reason for hiding this comment

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

Thank you!

@@ -0,0 +1,231 @@
package duke;

Choose a reason for hiding this comment

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

Perhaps you can divide into multiple packages 😃

Copy link
Author

Choose a reason for hiding this comment

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

Haha will take note

* A class used to represent a task. A task has a name and completion status.
*/
public abstract class Task {
protected static final String MARK_CHARACTER = "X";

Choose a reason for hiding this comment

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

Good use of static constants!

/**
* A class that handles the displaying of information to the user.
*/
public class Ui {

Choose a reason for hiding this comment

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

I like the abstraction and OOP used here!

Copy link

@totsukatomofumi totsukatomofumi left a comment

Choose a reason for hiding this comment

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

LGTM! Very simple yet beautiful logic of code. Coding standard has been well adhered to. Good job!

break;
default:
throw new DukeException("Command not recognised");
}

Choose a reason for hiding this comment

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

I like how simple yet powerful you have made your parser.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you!

/**
* Class used to represent a ToDo type task that has no date.
*/
public class ToDo extends Task {

Choose a reason for hiding this comment

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

I like the use of inheritance for a more OOP approach.

*
* @return A string that can be used to reconstruct the task.
*/
public abstract String toSaveFormatString();

Choose a reason for hiding this comment

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

I like the naming idea for this method.

+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
private static final String BOT_NAME = "Duke";

Choose a reason for hiding this comment

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

I like the use of a constant for this string that will be used often.

- Add Java asserts to handle some previously unhandled exceptions
    - TaskList: Use asserts to ensure null tasks cannot be added to the list
    - Duke: Use asserts to ensure Duke initializes correctly
* Refactor application launch process.
    - Move Launcher.main method to Duke.main.
    - Remove Launcher class since it is no longer used.
* Add constant TASK_TYPE_CHARACTER to ToDo, Deadline and Event. This is to centralize the information of which character refers to which type of task e.g. T associated to ToDo.
    - Modify toString and toSaveFormatString methods in all subclasses of Task to make use of this constant.
    - Modify Storage class to check against this constant when attempting to load in tasks from file.
* Move print statements to Duke's addToResponse method since all text to be displayed goes through that method.
- Move gradle.yml file to .github\workflows folder
- Add sorting command to Parser
- Add functionality to TaskList to sort by name
- Update Ui to respond correctly to new command
- Adjust argument format to be more flexible
- Update JUnit tests to account for changes to command format
- Remove new line from TaskList::addEvent exception message for invalid arguments
- Change GUI color scheme to dark mode
- Add help command to display available commands
- Add command format info to user feedback when user inputs invalid command
Improve GUI and user friendliness
- Add usage information for all commands to user guide
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.

3 participants