-
Notifications
You must be signed in to change notification settings - Fork 270
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
[Ng Hong Liang] iP #277
base: master
Are you sure you want to change the base?
[Ng Hong Liang] iP #277
Conversation
…ction and it's exception handling
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.
few suggestions to naming conventions and coding standards for switch cases. Otherwise, solid work handsome!
src/main/java/TimeParse.java
Outdated
this.helper(); | ||
} | ||
|
||
private LocalTime helper() { |
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.
maybe can use getTime here 😄
src/main/java/DateParse.java
Outdated
this.helper(); | ||
} | ||
|
||
private LocalDate helper() { |
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.
maybe can use getDate here? 😄
src/main/java/DukeException.java
Outdated
* @param curr Holds the capacity for the stored list, used to check if request is out of bounds | ||
* @throws DukeException | ||
*/ | ||
public void checker(String[] arr, int curr) throws DukeException { |
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.
maybe can use a more descriptive name for the method 😄
e.g
commandChecker
stringChecker
inputTester
src/main/java/ReadFile.java
Outdated
while (s.hasNext()) { | ||
String[] inputLine = s.nextLine().split("\\| ", 4); | ||
Task curr; | ||
switch(inputLine[0]) { |
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.
switch cases shouldn't be indented according to the coding standard 😄
otherwise v nice use of switch to differentiate the various commands
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, most of your code adheres to the coding standard, good job! Just a few minor nitpicks here and there
src/main/java/Deadline.java
Outdated
protected TimeParse time; | ||
|
||
/** | ||
* Constructor for Deadline class |
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.
Might be better to put a line after the JavaDoc descriptor and the params?
src/main/java/Duke.java
Outdated
@@ -1,10 +1,104 @@ | |||
import java.io.FileNotFoundException; |
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.
Can consider putting your Duke.java in a package?
src/main/java/Duke.java
Outdated
// If user inputs bye, terminate the program | ||
if (input.equals("bye")) { | ||
end = true; | ||
} |
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 use of in-line comments, they adhere to the coding standard's requirement as well
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.
Agreed! I like how you use in-line comments to help in code readability and understanding the code :)
src/main/java/ReadFile.java
Outdated
*/ | ||
public class ReadFile { | ||
|
||
public static final String ADDRESS = "data/duke.txt"; |
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 use of full caps for constants!
src/main/java/WriteFile.java
Outdated
fw.close(); | ||
} | ||
// | ||
// public static void main(String[] args) { |
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.
Can consider removing these few lines of code if they are not used?
src/main/java/Task.java
Outdated
@@ -0,0 +1,31 @@ | |||
public abstract class Task { | |||
protected String description; | |||
protected boolean isDone; |
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 boolean variable naming!
src/main/java/ReadFile.java
Outdated
case "T " : | ||
curr = new Todo(inputLine[2]); | ||
break; | ||
case "D " : |
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.
Same thing as mentioned by @DannyDakota, indentation should be removed
src/main/java/WriteFile.java
Outdated
|
||
public static final String ADDRESS = "data/duke.txt"; | ||
|
||
public WriteFile(ArrayList<Task> store) throws IOException { |
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.
Store might not be the best name for a task list, maybe naming it taskList might be a better choice?
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, I found some minor issues in naming. Otherwise, I really like the in-line comments in the code :)
src/main/java/DateParse.java
Outdated
import java.time.LocalDate; | ||
import java.time.format.DateTimeParseException; | ||
import java.util.ArrayList; | ||
import java.time.format.DateTimeFormatter; |
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 consider separating similar ones into blocks?
src/main/java/Deadline.java
Outdated
this.dateInfo = this.date.toString() + " " + this.time.toString(); | ||
} | ||
|
||
public String whatType() { |
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 consider naming the method with verbs such as 'getType()'?
src/main/java/Duke.java
Outdated
System.out.println("Hello from\n" + logo); | ||
Scanner scanner = new Scanner(System.in); | ||
String input = ""; | ||
Boolean end = false; |
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 use a name that sounds more like a boolean? What about something like 'isEnd' or 'isExited'?
src/main/java/Duke.java
Outdated
Scanner scanner = new Scanner(System.in); | ||
String input = ""; | ||
Boolean end = false; | ||
ArrayList<Task> store = new ArrayList(100); |
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 consider using a plural noun as the name of the ArrayList?
src/main/java/Duke.java
Outdated
// While loop ends when user inputs bye | ||
while(!end) { | ||
input = scanner.nextLine(); | ||
String[] splitInput = input.split(" ", 2); |
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 consider using a plural noun as a variable name here?
src/main/java/Duke.java
Outdated
// If user inputs bye, terminate the program | ||
if (input.equals("bye")) { | ||
end = true; | ||
} |
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.
Agreed! I like how you use in-line comments to help in code readability and understanding the code :)
Event and Deadline tasks does not check for assumptions that string parsed as date and time are of correct size. Event and Deadline tasks would cause Jeff to crash if certain assumptions are not met. Let's add assertions on those very variables have been added, hence throwing an assertion failure instead of adding an invalid entry into the list. Assertions impact on performance is considered low compared to its benefits.
Parser class have repeated conditional statements to check if the user gave valid inputs. To improve readability and code quality. Let's refractor said conditional statements by extract them into methods. Easiest way to reuse code that have are duplicates of each other. Allows easy navigation as they are on the same class file.
Add Assertions
Improve Code Quality
Jeff the task manager
Jeff allows you to have all your to-dos in one easy to access location. It's,
fastSUPER FAST to use 🔥How do I get Jeff? It's as easy as,
And voilà, Jeff would do everything for you!
Features: