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

Increments for iP #370

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

Increments for iP #370

wants to merge 30 commits into from

Conversation

Shuggan
Copy link

@Shuggan Shuggan commented Jan 31, 2023

Duke

"My laptop before me, and the world at my fingertips. Take pride coder" - Coder's creed source

Duke frees your mind of having to remember things you need to do. It's,

  • text-based
  • easy to learn
  • FAST SUPER FAST to use
  • Full of cute profile images

All you need to do is,

  1. download it from here.
  2. double-click it.
  3. add your tasks.
  4. let it manage your tasks for you 😉 hehe!

And it is FREE! Wow!

Features:

  • Managing tasks
  • Managing deadlines (coming soon)
  • Reminders (coming soon)

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

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

Copy link

@joellow88 joellow88 left a comment

Choose a reason for hiding this comment

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

Up to Week 2 (Level-6), the code is functional and meets all the weekly requirements. There are minor issues regarding the coding standard, and a few suggestions for refactoring in the Duke.java class.

}
Task t = new Task.Todo(textInput.substring(5));
taskList.add(t);
String output = String.format("Got it. I've added this task:\n%s\nNow you have %d tasks in the list", t.toString(), taskList.size());

Choose a reason for hiding this comment

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

This output line seems very long, is it possible to split them into 2 lines?
A similar issue appears in line 32, 78, 88.

if (textInput.equalsIgnoreCase("list")) {
System.out.println("Here are the tasks in your list:");
for (int i = 0; i < taskList.size(); i++) {
System.out.println(i + 1 + ". " + taskList.get(i).toString());

Choose a reason for hiding this comment

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

This manual string formatting works, however, have you considered using Java's builtin String.format method?

@@ -0,0 +1,5 @@
public class DukeException extends Exception{

Choose a reason for hiding this comment

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

For this class and your Task class, can you indent it with 4 spaces instead of 2?

taskList.remove(i - 1);
String output = String.format("Got it. I've removed this task:\n%s\nNow you have %d tasks in the list", t.toString(), taskList.size());
System.out.println(output);
continue;

Choose a reason for hiding this comment

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

I find the use of multiple continue instructions in the code strange. The while loop already has a looping behaviour once it reaches the end of the loop, so using continue to return to the start of the loop should not be a default behaviour. What is your rationale for designing it this way?

Rather, I would suggest the following structure:

boolean isRunning = true;
while (isRunning) {
    if (textInput.equalsIgnoreCase("bye")) {
        isRunning = false;
    } else if (stmt) {
        code;
    } else {
        code;
    }
}

Alternatively, you may consider parsing the command first, then using a switch-case statement to handle various cases.

@@ -1,10 +1,96 @@
import java.util.ArrayList;

Choose a reason for hiding this comment

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

Would prefer if the code was in a package, eg: package duke.

Shane Duggan and others added 20 commits February 10, 2023 01:46
These are mainly done when the user is adding tasks to the TaskList through "deadline" and "event".

Adding these assertions improves Duke's user experience and handles invalid user inputs better.
…es, and CSS styling.

There are several ways code quality was improved. For example, better OOP was implemented by abstracting away code from initialize() to setDuke() in MainWindow.java.

Improving the code quality helps to improve readability and adding CSS styling helps to improve the user experience.
This can be done with the following structure: "postpone <task name> /to <new deadline>".

Adding this postpone feature can improve the functionalities available to the user.
Added user guide for better readibility.
Add assertions to ensure that the user inputs are always valid.
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.

2 participants