-
Notifications
You must be signed in to change notification settings - Fork 187
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
[Guanlin] iP #187
base: master
Are you sure you want to change the base?
[Guanlin] iP #187
Conversation
src/main/java/GermaBot.java
Outdated
} | ||
|
||
public static void main(String[] args) { | ||
String WelcomeMessage = "____________________ \n" |
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 can use a constant or a method for the divider line
src/main/java/GermaBot.java
Outdated
import java.util.Scanner; | ||
|
||
public class GermaBot { | ||
public static int getIdx(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.
Perhaps can rename to getIndex to make it more readable when as your code gets much bigger
src/main/java/GermaBot.java
Outdated
String echo; | ||
Scanner in = new Scanner(System.in); | ||
echo = in.nextLine(); | ||
if (echo.equals("bye")) { |
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.
A bit nitpicky but you can include your goodbye message code here. Would make the code more readable.
src/main/java/GermaBot.java
Outdated
printCounter++; | ||
} | ||
} else if (echo.contains("unmark")) { | ||
int idx = getIdx(echo); |
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.
Similar to the comment for getIndex. Perhaps can name "idx" to some other variable name which is more easy to follow when debugging.
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 on your coding standards, however there are some code quality improvements to be made
|
||
public class GermaBot { | ||
static int counter = 0; | ||
static final String LINE= "____________________________________________"; |
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 on declaring constant
} | ||
|
||
public static void createTodo(String input) throws EmptyTaskException { | ||
String toDoTask = input.substring(input.indexOf("todo ") + 5); |
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.
what is 5? do avoid magic numbers
if (idxOfEndDate == -1) { | ||
throw new MissingDeadlineException(); | ||
} | ||
String date = description.substring( idxOfEndDate + 4); |
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.
what does 4 here stand for? do check through your code for more magic numbers
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.
String date = description.substring( idxOfEndDate + 4); | |
String date = description.substring(idxOfEndDate + 4); |
} | ||
|
||
} |
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.
why is there a newline between these 2 brackets?
} else { | ||
int printCounter = 1; | ||
System.out.println("Gotcha! Here are your tasks:"); | ||
for (int i = 0; i < counter; i++) { | ||
if (toDoList[i] == null) { | ||
break; | ||
} | ||
System.out.println(printCounter + ". " + toDoList[i].toString()); | ||
printCounter++; | ||
} | ||
} |
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 part is deeply nested, try to avoid deep nesting
} | ||
} | ||
|
||
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.
this method is very long, try to shorten it
add find function and create new IllegalArgumentException
add javadoc comments to classes
# Conflicts: # src/main/java/MainRuntime/GermaBot.java
No description provided.