Skip to content

samuelory iP#173

Open
samuelory wants to merge 29 commits into
nus-cs2113-AY2324S2:masterfrom
samuelory:master
Open

samuelory iP#173
samuelory wants to merge 29 commits into
nus-cs2113-AY2324S2:masterfrom
samuelory:master

Conversation

@samuelory

Copy link
Copy Markdown

No description provided.

@OKW32 OKW32 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall good job on following coding standards

Comment thread src/main/java/OGF.java Outdated
int taskNo;
while (true) {
String input = scanner.nextLine();
switch (input.split(" ")[0]) {

@OKW32 OKW32 Feb 8, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider storing the first word of user input in a variable

Suggested change
switch (input.split(" ")[0]) {
String command = input.split(" ")[0]
switch (command) {

Comment thread src/main/java/OGF.java Outdated


Task[] tasks = new Task[100];
int numItem = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

numberOfTasks might have been a better variable name

Comment thread src/main/java/Task.java Outdated
@@ -0,0 +1,38 @@
public class Task {

@OKW32 OKW32 Feb 8, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that the boolean names sound booleany

Comment thread src/main/java/OGF.java Outdated
@@ -0,0 +1,60 @@
import java.util.Scanner;

@OKW32 OKW32 Feb 8, 2024

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that all variable names are declared with camelCase

Geinzit

This comment was marked as outdated.

Comment thread src/main/java/OGF.java Outdated


Task[] tasks = new Task[100];
int numItem = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unclear variable name

Comment thread src/main/java/Task.java
if (this.isDone){
return("[X] " + this.taskName);
}
else{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be in one line: } else {

Comment thread src/main/java/OGF.java Outdated
int taskNo;
while (true) {
String input = scanner.nextLine();
switch (input.split(" ")[0]) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

magic number: [0]?

Comment thread src/main/java/OGF.java Outdated
System.out.println("Alright, adding this task to the list: ");
System.out.println(tasks[numItem]);
numItem++;
System.out.printf("You have %d tasks in the list.%n", numItem);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can use println instead

Comment thread src/main/java/Task.java
@@ -0,0 +1,38 @@
public class Task {
protected String taskName;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unclear variable name: does taskName refer to the description, the type of the task, or the task object itself?

@Geinzit Geinzit left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall very clean code and very rich features! Good Job!

Comment thread src/main/java/Event.java
@@ -0,0 +1,20 @@
public class Event extends Task {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better name to reflect the inheritance might be EventTask

@@ -0,0 +1,17 @@
public class Deadline extends Task{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better name to reflect the inheritance relationship might be DeadlineTask

Comment thread src/main/java/OGF.java Outdated
Comment on lines +77 to +80
System.out.println("Alright, adding this task to the list: ");
System.out.println(tasks[numItem]);
numItem++;
System.out.printf("You have %d tasks in the list.%n", numItem);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's best to not repeat yourself, and put these commands into a separate method.

Comment thread src/main/java/Task.java
return taskName;
}

public boolean getDone(){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkIsDone may be a better name to reflect the boolean nature of the variable to get

@Joellimjr Joellimjr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job so far, but there are still a few improvements to be made

super(description);
this.deadlineString = deadline;
}
@Override

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps you can leave a line between methods for improved readability

Comment thread src/main/java/OGF.java Outdated
Task[] tasks = new Task[100];
int numItem = 0;
Scanner scanner = new Scanner(System.in);
int taskNo;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps you can name it taskNum to make it more clear

Comment thread src/main/java/OGF.java Outdated
case ("unmark"):
taskNo = Integer.parseInt(input.split(" ")[1])-1;

if (input.split(" ")[0].equals("mark")){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps set your mark case as its own case rather than a fallthrough and processing it within your unmark case. helps with readability as well

Comment thread src/main/java/OGF.java Outdated


Task[] tasks = new Task[100];
int numItem = 0;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could be interpreted as item number or number of items which could be confusing

@@ -0,0 +1,17 @@
public class Deadline extends Task{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments are missing for the entire code. Good to have them for better readability.

Comment thread src/main/java/Event.java
Comment on lines +2 to +3
private final String startTime;
private final String endTime;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work with the usage of Access Modifiers.

Comment thread src/main/java/OGF.java Outdated
return (false);
case ("list"):
System.out.println("Here are your tasks for today: ");
for (int i = 0; i < numItem; i++) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid usage of Magic Numbers and literals.

Comment thread src/main/java/OGF.java Outdated
printBreakLine();
}

private static boolean handleInput (String input) throws OGFException{

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very long method. Avoid long methods and take corrective action if a method exceeds 30 lines of code.

Comment thread src/main/java/OGF.java Outdated
printBreakLine();
break;
case ("todo"):
if (!input.contains(" ") || input.indexOf(" ") == input.length()-1){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a complex statement, so try to break it down into two boolean variables which handle each sub-expression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants