[xinyi-lim-19] iP#650
Conversation
In build.gradle, the dependencies on distZip and/or distTar causes
the shadowJar task to generate a second JAR file for which the
mainClass.set("seedu.duke.Duke") does not take effect.
Hence, this additional JAR file cannot be run.
For this product, there is no need to generate a second JAR file
to begin with.
Let's remove this dependency from the build.gradle to prevent the
shadowJar task from generating the extra JAR file.
jarretphon
left a comment
There was a problem hiding this comment.
Good work!
Consider fixing some of the coding standard violations to improve readability.
| Task(String description) { this.description = description; this.isDone = false; } | ||
| void mark() { this.isDone = true; } | ||
| void unmark() { this.isDone = false; } | ||
| String statusIcon() { return isDone ? "X" : " "; } | ||
| @Override public String toString() { return "[" + statusIcon() + "] " + description; } |
There was a problem hiding this comment.
I noticed that the brackets are not in Egyptian Style. This is present in several other places as well.
| String input = br.readLine(); | ||
| if (input == null) { exit(); break; } | ||
| String cmd = input.trim(); | ||
| if (cmd.isEmpty()) { error("Please enter a command (try: todo, deadline, event, list, mark, unmark, delete, bye)."); continue; } |
There was a problem hiding this comment.
Should the multiple statements on this line be separated by newlines? I noticed this issue in several other places as well.
| import java.nio.file.*; | ||
| import java.util.*; |
There was a problem hiding this comment.
Perhaps you may only want to import the classes that are utilised in the package.
| switch (type) { | ||
| case "T": | ||
| return new Todo(desc, done); | ||
| case "D": { | ||
| LocalDateTime by = LocalDateTime.parse(parts[3]); // ISO | ||
| return new Deadline(desc, done, by); | ||
| } | ||
| case "E": { | ||
| String timeslot = parts[3]; | ||
| return new Event(desc, done, timeslot); | ||
| } | ||
| default: | ||
| return null; // unknown type (treat as corrupted) |
There was a problem hiding this comment.
I noticed that the case blocks are indented within the switch block. Perhaps, you might want to un-indent them for consistency with the coding standards?
| public List<String> load() throws IOException { | ||
| if (Files.notExists(file)) { | ||
| return List.of(); // first run—no data yet | ||
| } | ||
| return Files.readAllLines(file, StandardCharsets.UTF_8); | ||
| } |
There was a problem hiding this comment.
I like how clean and readable this bit of code is.
There was a problem hiding this comment.
Just a question, why is there both a Duke.java file and Bob.java? which one is the main chatbot?
| String cmd = input.trim(); | ||
| if (cmd.isEmpty()) { error("Please enter a command (try: todo, deadline, event, list, mark, unmark, delete, bye)."); continue; } | ||
|
|
||
| try { |
There was a problem hiding this comment.
Perhaps it would be cleaner to abstract out this command input comparison into the Parser class 🤔
There was a problem hiding this comment.
Perhaps you should group the different kind of task, todo, deadline,... under the Task package or something like for cleaner directory structure!
./gradlew run 3. Type commands like todo borrow book 4. Let **Bob** do the rest 😉 ---
./gradlew run 3. Type commands like todo borrow book 4. Let **Bob** do the rest 😉 ---
Bob
Bob is a friendly chatbot that helps you manage your tasks.
It is text-based, easy to use, and
boringactually fun!✨ Features
📝 Getting Started
./gradlew runtodo borrow book