-
Notifications
You must be signed in to change notification settings - Fork 362
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
[Joshua Chiang] iP #374
base: master
Are you sure you want to change the base?
[Joshua Chiang] iP #374
Conversation
Implement a skeletal version of Cluck that starts by greeting the user, simply echos commands entered by the user, and exits when the user types bye.
…tion, 2. Deadlines with description and due date, 3. Events with description, start and end time
Use the input/output redirection technique to semi-automate the testing of Duke(or rather, CLUCK)
Adding exception classes to handle errors by Duke
Now you can delete tasks from the todo list with Cluck. Tasks are also now stored in an ArrayList.
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.
In terms of coding standard, it looks mostly fine, except a few naming issues and unnecessary white spaces.
Some improvements requested below.
src/main/java/Duke.java
Outdated
static private final String MAKE_DEADLINE = "deadline"; | ||
static private final String MAKE_TODO = "todo"; | ||
static private final String MAKE_EVENT = "event"; | ||
static private final String DUE_DATE_FLAG = "/by "; | ||
static private final String EVENT_START_FLAG = "/from "; | ||
static private final String EVENT_END_FLAG = "/to "; |
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.
Should the "static" keyword come before the access modifier ("private" in this case)?
private static final
might be the preferred format.
Namings align with the coding standard, which is great!
src/main/java/Deadline.java
Outdated
return this.isMarked | ||
? String.format("[D][X] %1$s (by: %2$s)", this.description, this.dueDate) | ||
: String.format("[D][ ] %1$s (by: %2$s)", this.description, this.dueDate); |
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.
Could this method make use of abstraction so that the toString()
method in the parent class Task could be used here? Then, you would only need to add the correct task icon ("D" for Deadline here) and the due date, making it easier to read.
src/main/java/Duke.java
Outdated
boolean loop = true; | ||
List<Task> toDoList = new ArrayList<>(); |
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.
Perhaps a better name could be used for the boolean
name sound more like a boolean. toDoList could also be renamed to be more specific and descriptive of a container of multiple tasks.
boolean loop = true; | |
List<Task> toDoList = new ArrayList<>(); | |
boolean isActive = true; | |
List<Task> tasks = new ArrayList<>(); |
src/main/java/Event.java
Outdated
return this.isMarked | ||
? String.format("[E][X] %1$s (from:%2$s to:%3$s)", this.description, this.startTime, this.endTime) | ||
: String.format("[E][ ] %1$s (from:%2$s to:%3$s)", this.description, this.startTime, this.endTime); |
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.
Similar to the comment under Deadline, perhaps this could make use of the toString()
method in the parent class Task?
src/main/java/Duke.java
Outdated
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" You gotta give me a command!"); | ||
System.out.println(" ____________________________________________________________"); | ||
|
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.
Perhaps remove unnecessary white spaces between lines of code, such as within the switch statement? So that the format is standardised. This applies to some parts above too.
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 code is clean and nice
src/main/java/Duke.java
Outdated
static private final String EVENT_END_FLAG = "/to "; | ||
|
||
public static boolean isNumeric(String strNum) { | ||
if (strNum == null) { |
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.
Love your code! Tidy and clean
src/main/java/Duke.java
Outdated
Integer itemNumber = Integer.parseInt(words[1]); | ||
if (itemNumber > toDoList.size() || itemNumber <= 0) { | ||
System.out.println(" ____________________________________________________________"); | ||
System.out.println(" That's not...? In the list...? Buh caw?"); |
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.
Interesting and Creative ui design
src/main/java/Duke.java
Outdated
Scanner sc = new Scanner(System.in); | ||
|
||
while (loop) { | ||
String input = sc.nextLine(); |
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.
Should we add a sc.close() at the end
Making the Task class abstract ensures that it cannot be instantiated. The new makeSaveFormat() function is an abstract method in Task, and it is overridden in each child class such that it returns a string that is formatted with respect to the child class for saving tasks.
Now the tasks in the todo list are saved into a txt file with consistent formmating with respect to the type of task. It also captures the status of the task, whether or not it is marked or unmarked.
Save the tasks in the hard disk automatically whenever the task list changes. Load the data from the hard disk when Cluck starts up.
…e and restructure of package Instead of saving the due dates of deadlines as strings they are now LocalDateTime objects which uses the java.time.LocalDateTime package
Added support for gradle to the project as well as denpendencies and tests
# Conflicts: # src/main/java/Deadline.java # src/main/java/Tasks/Task.java
# Conflicts: # src/main/java/Deadline.java # src/main/java/Tasks/Task.java
# Conflicts: # src/main/java/Tasks/Task.java
Added Exceptions for better exception handling
To allow for better OOP and more packages down the line, the files have been renamed and restructured.
TaskList is created to handle task operations. TaskIndexOutOfBoundsException is thrown when a given index is out of the range of the taskList TaskNotFoundException is thrown when a task is not found within a taskList (function that throws this is yet to be implemented)
Branch fix user guide
Improve formatting of user guide
Fixing indentation levels
…nch-fixUserGuide
Branch fix user guide
The Cluck!.jar now creates a directory and a text file that saves the tasks of the user
Fixed saving issue for Cluck!
# Conflicts: # src/main/java/cluck/Cluck.java # src/main/java/cluck/storage/Storage.java
Make Cluck! close on bye command
Previous implementation to allow for more flexble parsing of date time given by the user cause some problems. In the previous commit I added optional patterns to allow for user to input various forms of date time, e.g. the user can input either 06, Jun, or June for a date on june. The user also has the option to omit the century of the year (i.e. the "20" in "2023") or minute of the time. The change in FORMATTER in the task class cause the toString() and makeSaveFormat() methods in Event and Deadline classes to format the LocalDateTime classes into the wrong format, as the FORMATTER's optional patterns are all used to format the LocalDateTime, resulting in strange date strings like "21 03MarMarc 202323 1200". To resolve the issue, I added an additional formatter by the name of default formatter where the DateTimeFormatter does not have optional patterns, and thus gives us consistent and correct string formats of the date when used by toString() and makeSaveFormat() methods.
Branch c natural dates
User guide now contains additional information about the newly added date time format
Updated user guide
Fix user guide formattiing
This class was a feature that was in progress, not to be committed in master
Branch c natural dates
Cluck! 🐔
Cluck! helps you keep track of your tasks, so you can go about your day by putting all your eggs in one basket.
All you need to do is:
Did we mention it was FREE?!
Features:
If you Java programmer, you can use it to practice Java too. Here's the
main
method: