Skip to content
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

samuelory iP #173

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

samuelory iP #173

wants to merge 29 commits into from

Conversation

samuelory
Copy link

No description provided.

Copy link

@OKW32 OKW32 left a comment

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

int taskNo;
while (true) {
String input = scanner.nextLine();
switch (input.split(" ")[0]) {
Copy link

@OKW32 OKW32 Feb 8, 2024

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) {



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

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

@@ -0,0 +1,38 @@
public class Task {
Copy link

@OKW32 OKW32 Feb 8, 2024

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

@@ -0,0 +1,60 @@
import java.util.Scanner;
Copy link

@OKW32 OKW32 Feb 8, 2024

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.



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

Choose a reason for hiding this comment

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

unclear variable name

if (this.isDone){
return("[X] " + this.taskName);
}
else{
Copy link

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 {

int taskNo;
while (true) {
String input = scanner.nextLine();
switch (input.split(" ")[0]) {
Copy link

Choose a reason for hiding this comment

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

magic number: [0]?

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

Choose a reason for hiding this comment

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

can use println instead

@@ -0,0 +1,38 @@
public class Task {
protected String taskName;
Copy link

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?

Copy link

@Geinzit Geinzit left a comment

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!

@@ -0,0 +1,20 @@
public class Event extends Task {
Copy link

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

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 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

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.

return taskName;
}

public boolean getDone(){
Copy link

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

Copy link

@Joellimjr Joellimjr left a comment

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

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

Task[] tasks = new Task[100];
int numItem = 0;
Scanner scanner = new Scanner(System.in);
int taskNo;

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

case ("unmark"):
taskNo = Integer.parseInt(input.split(" ")[1])-1;

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

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



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

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{

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 on lines 2 to 3
private final String startTime;
private final String endTime;

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.

return (false);
case ("list"):
System.out.println("Here are your tasks for today: ");
for (int i = 0; i < numItem; i++) {

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.

printBreakLine();
}

private static boolean handleInput (String input) throws OGFException{

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.

printBreakLine();
break;
case ("todo"):
if (!input.contains(" ") || input.indexOf(" ") == input.length()-1){

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