[Qin Kai] iP#98
Conversation
AdiMangalam
left a comment
There was a problem hiding this comment.
Overall good. Can improve on coding standards like have better variable names, split into different methods, have different files etc.
|
|
||
| public class bro { | ||
|
|
||
| private static ArrayList<String> storer = new ArrayList<>(); |
There was a problem hiding this comment.
Can have a better variable name. Maybe specify what 'storer' stores.
| public static void level0() { | ||
| System.out.println("Hello! I'm bro"); | ||
| System.out.println("What can I do for you?"); | ||
| System.out.println("Bye. Hope to see you again soon!"); |
There was a problem hiding this comment.
This line should not be here? The chatbot prints Bye almost instantly
| System.out.println("Nice! I've marked this task as done:"); | ||
| System.out.println("[X] " + storer.get(task_num)); | ||
|
|
||
| } else if (split_line[0].equals("unmark")) { |
There was a problem hiding this comment.
Should have made 'unmark' as another method. That way it is easier to debug/make changes.
| System.out.println(line); | ||
| } | ||
|
|
||
| System.out.println("Bye. Hope to see you again soon!"); |
There was a problem hiding this comment.
This line is redundant. Needs to be displayed only when 'bye' is entered by user.
AdiMangalam
left a comment
There was a problem hiding this comment.
Overall good. Can have better coding standards.
|
|
||
| public class bro { | ||
|
|
||
| private static final ArrayList<String> storer = new ArrayList<>(); |
There was a problem hiding this comment.
Have a better variable name. Can specify what 'storer' stores?
danusan-s
left a comment
There was a problem hiding this comment.
I have no idea what's going on here. Code does not even do what is expected from the increments. Lots of improvements can be made. Also remove redundant functions.
| System.out.println("Bye. Hope to see you again soon!"); | ||
| } | ||
|
|
||
| public static void echo() { |
There was a problem hiding this comment.
Did not remove redundant function that is no longer used.
| private static final ArrayList<String> storer = new ArrayList<>(); | ||
| private static final ArrayList<String> mark_tracker = new ArrayList<>(); | ||
|
|
||
| public static void level0() { |
There was a problem hiding this comment.
Did bro hard code level 0 ? 😭 Did not remove redundant function again.
| public class bro { | ||
|
|
||
| private static final ArrayList<String> storer = new ArrayList<>(); | ||
| private static final ArrayList<String> mark_tracker = new ArrayList<>(); |
There was a problem hiding this comment.
Could have use a seperate class for Tasks to track the info and marking
| String line; | ||
| Scanner in = new Scanner(System.in); | ||
|
|
||
| while (true) { |
There was a problem hiding this comment.
Wait if you have while(true) loop in your addList and you call your mark only after addList, wouldnt you be marking after the user inputs bye.
| String line; | ||
| Scanner in = new Scanner(System.in); | ||
|
|
||
| while(true) { |
There was a problem hiding this comment.
Bro 😭, You can't add tasks once you are in marking mode ?
Agreed that I should put more time into it but the code does output what was needed for the first three levels. Just I haven't really cleaned the code yet but functionality is there. Also didn't upload part 4 yet; do you mind checking again once I updated my code. |
| import java.util.ArrayList; | ||
| import java.io.*; | ||
|
|
||
| public class bro { |
There was a problem hiding this comment.
The class name bro should follow Java naming conventions. Use PascalCase for class names. Consider renaming it to something more descriptive, like TaskManager or TaskApp.
|
|
||
| } | ||
|
|
||
| public static void addList() { |
There was a problem hiding this comment.
Use descriptive names for your methods. For example, addList could be renamed to manageTasks, as it implies that this method is responsible for task management
| while (true) { | ||
| line = in.nextLine(); | ||
|
|
||
| if (line.equals("Bye")) { |
There was a problem hiding this comment.
Avoid using magic strings directly in your code (e.g., "Bye", "list", "todo"). Instead, consider defining constants at the beginning of your class to improve readability and maintainability.
| saveTasks(); | ||
| } | ||
|
|
||
| } else if (line.startsWith("deadline")) { |
There was a problem hiding this comment.
The sections handling different task types (Todo, Deadline, Event) have similar patterns for adding and saving tasks. Can create a helper method to reduce duplication
| storer.add(todo); | ||
| break; | ||
| case "D": | ||
| Deadline ddl = new Deadline(parts[2], parts[3]); |
There was a problem hiding this comment.
Variables like ddl, taskInt, and task_num can be more descriptive. For instance, use deadlineTask instead of ddl, and taskIndex instead of taskInt. Consistency in naming conventions (camelCase) is also important
|
|
||
| } | ||
|
|
||
| public static void addList() { |
There was a problem hiding this comment.
The addList method is quite long. Break it down into smaller methods for each task type handling to improve readability and maintainability.
I am a person.