-
Notifications
You must be signed in to change notification settings - Fork 193
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
[Izdiyad] iP #184
base: master
Are you sure you want to change the base?
[Izdiyad] iP #184
Conversation
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.
good job with following coding standards overall!
src/main/java/Deadline.java
Outdated
public class Deadline extends Task { | ||
protected String by; | ||
|
||
public Deadline(String description, String by) { |
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.
Well done with naming classes in PascalCase
src/main/java/Duke.java
Outdated
private static int taskCount; | ||
|
||
// prints a string within two horizontal lines, @param is string to be printed | ||
public static void printWithLines(String text) { |
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.
Good job with writing method names in camelCase
src/main/java/Duke.java
Outdated
String inputCommand = input.trim().split(" ")[0]; | ||
String inputData = input.replaceFirst(inputCommand, "").trim(); | ||
|
||
switch (inputCommand){ |
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.
good job with the indentation of switch cases
src/main/java/Duke.java
Outdated
taskCount++; | ||
} | ||
|
||
public static void listTasks() { |
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.
egyptian style brackets used, well done!
src/main/java/Duke.java
Outdated
|
||
public static void addTask(String task) { | ||
|
||
if (task.startsWith("todo")) { |
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.
curly braces used for all if-else statements, well done
src/main/java/Duke.java
Outdated
public class Duke { | ||
public static void main(String[] args) { | ||
private static Task[] tasks; | ||
private static int taskCount; |
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.
variable names are in camelCase, nice job
src/main/java/Duke.java
Outdated
printWithLines(byeMessage); | ||
} | ||
|
||
public static void addTask(String task) { |
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.
Add comments on how the method works and explain the parameters
src/main/java/Duke.java
Outdated
|
||
public static void addTask(String task) { | ||
|
||
if (task.startsWith("todo")) { |
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.
I think can work on the readability of the code by creating a method for each else if statement.
src/main/java/Duke.java
Outdated
} | ||
|
||
public static void selectCommand(String input) { |
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.
Recommend to refractor code to include a task manager to handle all the task events instead of all in duke.java
src/main/java/Task.java
Outdated
protected String description; | ||
protected boolean isDone; | ||
|
||
public Task(String description) { |
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.
Good to include comments to explain what Task is
Give users a way to find a task by searching for a keyword.
# Conflicts: # src/main/java/duke/Parser.java # src/main/java/duke/TaskList.java
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.
Your code follows good OOP structure. Good code style and quality is mostly observed. LGTM! Good job!
src/main/java/duke/Duke.java
Outdated
ui.printWithLines(e.getMessage()); | ||
} | ||
|
||
// Gets the next command entered |
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.
The code is well structured and easy to understand what the code is doing here. Hence, this comment seems redundant. You may want to consider removing it :)
src/main/java/duke/Parser.java
Outdated
public Command addTask(String input) throws DukeException { | ||
|
||
if (input.startsWith(TODO)) { | ||
if (input.substring(4).isEmpty()) { |
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.
4 seems to be a Magic Number
src/main/java/duke/Parser.java
Outdated
trimInput(input); | ||
|
||
} else if (input.startsWith(DEADLINE)) { | ||
if (!input.contains("/by")) { |
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.
You can also consider making "/by"
a constant just like DEADLINE
src/main/java/duke/Parser.java
Outdated
Command commandFromInput = null; | ||
|
||
switch (trimmedInput){ | ||
case TODO: case DEADLINE: case EVENT: |
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.
When you have multiple cases and you want the control to cascade down, you can still follow the same recommended code style to have each case in a new line.
|
||
protected Ui ui; | ||
protected TaskList tasks; | ||
private int targetIndex = -1; |
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.
This private variable is declared in this abstract class but not used. Do you need this variable?
No description provided.