Conversation
Let's tweak the docs/README.md (which is used as the user guide) to fit Duke better. Specifically, 1. mention product name in the title 2. mention adding a product screenshot and a product intro 3. tweak the flow to describe feature-by-feature
Joshuahoky
left a comment
There was a problem hiding this comment.
Consider refactoring main in Floda.java into different methods to make the code easier to read and understand. Otherwise, code follows Java coding standard well and is of high quality
| this.by = by; | ||
| } | ||
|
|
||
| @Override |
There was a problem hiding this comment.
Great use of Override annotation to signal method overriding
src/main/java/Floda.java
Outdated
| } else { | ||
| System.out.println("Invalid task number! Please check with 'list'."); | ||
| } | ||
| } else { |
src/main/java/Floda.java
Outdated
|
|
||
| public class Floda { | ||
| public static void main(String[] args) { | ||
| String name = "Floda"; |
There was a problem hiding this comment.
Redundant code as it can be combined with the next line
eg. System.out.println("Hello! I'm Floda");
lordgareth10
left a comment
There was a problem hiding this comment.
Looks okay to me, the coding standards were mostly adhered to in general, however some parts which I commented on could be refactored to improve logical flow and readability.
There was a problem hiding this comment.
Could consider refactoring to use separate methods to handle individual command types. For example, if the command is "event" you could use a handleEventInput() method to parse the string and add the object to the list. This will improve readability considerably.
| @@ -0,0 +1,83 @@ | |||
| import java.util.Scanner; | |||
There was a problem hiding this comment.
I like how you specified java.util.Scanner instead of java.util.* , this complies with coding standards, well done !
src/main/java/Floda.java
Outdated
|
|
||
| public class Floda { | ||
| public static void main(String[] args) { | ||
| String name = "Floda"; |
There was a problem hiding this comment.
Should this be a constant? And if it was then perhaps you could have used (public static final string) and capitalised the variable name (NAME) to follow the coding standards.
src/main/java/Floda.java
Outdated
| while (!"bye".equals((line = scanner.nextLine()))) { | ||
| if ("list".equals(line)) { | ||
| System.out.println("List so far: "); | ||
| for (int i = 0; i < taskCounter; i++) { | ||
| System.out.println((i + 1) + "." + list[i]); | ||
| } | ||
| } else if (line.startsWith("mark")) { | ||
| Scanner taskScanner = new Scanner(line); | ||
| taskScanner.next(); | ||
| if (taskScanner.hasNextInt()) { | ||
| int taskNumber = taskScanner.nextInt() - 1; | ||
| if (taskNumber >= 0 && taskNumber < taskCounter) { | ||
| list[taskNumber].setDone(true); | ||
| System.out.println("I have marked this task as done:\n" + list[taskNumber]); | ||
| } else { | ||
| System.out.println("Invalid task number! Please check with 'list'."); |
There was a problem hiding this comment.
Perhaps you could refactor the code into smaller methods that handle the logic without having to have so many levels of nesting, this would make the code more readable.
| this.description = description; | ||
| } | ||
|
|
||
| public boolean isDone() { |
There was a problem hiding this comment.
I like how the boolean method isDone is namd to sound like a boolean!
src/main/java/Floda.java
Outdated
| System.out.println("I can keep track of a to-do list for you! Just type what you want to add to the list."); | ||
| while (!"bye".equals((line = scanner.nextLine()))) { |
There was a problem hiding this comment.
It would improve readability if you directly assigned String line = scanner.nextLine() in the previous line instead of assigning it inside the conditional for the while loop. Then you could read in a new line of input at the end of every if else block.
# Conflicts: # src/main/java/Floda.java
nichyjt
left a comment
There was a problem hiding this comment.
Hi Shawn,
Your code is generally well structured. Good job!
There are some repeated mistakes in the codebase (such as magic literals), so do take note.
There are some other specific comments below. Try and fix them before the next tutorial!
For your consideration: There is a way to autoformat your code automatically every time you Ctrl-S on intellij which will save you much pain. :)
src/main/java/Floda.java
Outdated
| private final static String NAME = "Floda"; | ||
| private static final String FILE_PATH = "./data/tasks.txt"; |
There was a problem hiding this comment.
I'm not sure why the NAME constant left out the static keyword?
Add branch
No description provided.