-
Notifications
You must be signed in to change notification settings - Fork 78
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
imaginarys96 iP #73
base: master
Are you sure you want to change the base?
imaginarys96 iP #73
Conversation
src/main/java/Task.java
Outdated
@@ -1,10 +1,11 @@ | |||
public class Task { | |||
protected String description; | |||
protected boolean isDone; | |||
|
|||
public Task(String description) { | |||
protected String type; |
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.
type is ambiguous, can be mistaken as a verb, recommend to use taskType
src/main/java/Chatbot.java
Outdated
} | ||
System.out.println("____________________________________________________________"); | ||
} else if ( input.startsWith("mark ") ) { | ||
} else if (input.startsWith("mark ")) { | ||
String number = input.replace("mark ", "").trim(); |
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.
number is ambiguous, recommend to use taskNumber
src/main/java/Chatbot.java
Outdated
} | ||
System.out.println("____________________________________________________________"); | ||
} else if ( input.startsWith("mark ") ) { | ||
} else if (input.startsWith("mark ")) { | ||
String number = input.replace("mark ", "").trim(); | ||
int markTaskNo = Integer.parseInt(number); |
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.
noun should not be named with a verb in it, recommend to combine with previous line and use taskNumber as previously mentioned
src/main/java/Chatbot.java
Outdated
if( markTaskNo > 0 ) { | ||
tasks[markTaskNo-1].markAsDone(); | ||
if (markTaskNo > 0) { | ||
tasks[markTaskNo - 1].markAsDone(); |
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.
using -1 magical number, would be good to define what the -1 means
src/main/java/Chatbot.java
Outdated
System.out.println("____________________________________________________________"); | ||
} else if ( input.startsWith("unmark ") ) { | ||
} else if (input.startsWith("unmark ")) { | ||
String number = input.replace("unmark ", "").trim(); | ||
int unmarkTaskNo = Integer.parseInt(number); |
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 name can be mistaken as an action, recommend to use unmarkedTaskNo
src/main/java/Chatbot.java
Outdated
System.out.println( " [" + tasks[unmarkTaskNo-1].getStatusIcon() + "] " + tasks[unmarkTaskNo-1].getDescription() ); | ||
System.out.println(" [" + tasks[unmarkTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkTaskNo - 1].getDescription()); | ||
System.out.println("____________________________________________________________"); | ||
} else if ( input.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.
unnecessary spaces for start and ends of brackets
src/main/java/Task.java
Outdated
@@ -19,4 +20,6 @@ public void markAsUndone() { | |||
this.isDone = false; | |||
} | |||
|
|||
public String getTypeIcon() { return type; } |
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 bracket should start on a newline
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 good job but some coding quality and standards to follow!
src/main/java/chatbot/Chatbot.java
Outdated
@@ -0,0 +1,128 @@ | |||
package chatbot; | |||
|
|||
import chatbot.*; |
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.
Imported classes should always be listed explicitly (avoid *)
src/main/java/chatbot/Chatbot.java
Outdated
|
||
public class Chatbot { | ||
|
||
public static void main(String[] args) throws Exception { |
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.
Avoid long methods of more than 30 LoC
src/main/java/chatbot/Chatbot.java
Outdated
System.out.println("____________________________________________________________"); | ||
System.out.println(" Here are the tasks in your list:"); | ||
for (int i = 0; i < numOfTasks; i++) { | ||
//System.out.println(" " + (i + 1) + ".[" + tasks[i].getTypeIcon() + "][" + tasks[i].getStatusIcon() + "] " + tasks[i].getDescription()); |
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.
Remove commented code
src/main/java/chatbot/Chatbot.java
Outdated
System.out.println(" [" + tasks[unmarkedTaskNo - 1].getStatusIcon() + "] " + tasks[unmarkedTaskNo - 1].getDescription()); | ||
System.out.println("____________________________________________________________"); | ||
} else if (input.startsWith("todo")) { | ||
String msg = input.replace("todo", "").trim(); |
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.
Avoid foreign language words, slang, and names (msg)
src/main/java/chatbot/Chatbot.java
Outdated
System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list."); | ||
System.out.println("____________________________________________________________"); | ||
} else if (input.startsWith("deadline")) { | ||
String msg = input.replace("deadline", "").trim(); |
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.
Avoid foreign language words, slang, and names (msg)
src/main/java/chatbot/Chatbot.java
Outdated
} | ||
|
||
String byDate = msg.substring(msg.indexOf("/by ") + 4).trim(); // will contain the byDate | ||
String desc = msg.substring(0, msg.indexOf("/by")); // will contain the deadline 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.
Avoid foreign language words, slang, and names (desc)
src/main/java/chatbot/Chatbot.java
Outdated
System.out.println(" Now you have " + String.valueOf(numOfTasks) + " tasks in the list."); | ||
System.out.println("____________________________________________________________"); | ||
} else if (input.startsWith("event")) { | ||
String msg = input.replace("event", "").trim(); |
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.
Avoid foreign language words, slang, and names (msg)
src/main/java/chatbot/Chatbot.java
Outdated
String dateRange = msg.substring(msg.indexOf("/from ") + 6).trim(); | ||
String fromDate = dateRange.substring(0, dateRange.indexOf("/to ")).trim(); | ||
String toDate = dateRange.substring(dateRange.indexOf("/to ") + 4).trim(); | ||
String desc = msg.substring(0, msg.indexOf("/from ")); // will contain the deadline 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.
Avoid foreign language words, slang, and names (desc)
text-ui-test/runtest.bat|sh scripts generate a file ACTUAL.TXT. However, .gitignore uses ACTUAL.txt, which means the generated file will not be ignored by Git on non-Windows OS. Let's update .gitignore as ACTUAL.txt -> ACTUAL.TXT
No description provided.