-
Notifications
You must be signed in to change notification settings - Fork 102
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
[Owen] iP #107
base: master
Are you sure you want to change the base?
[Owen] iP #107
Conversation
Updated the Execptions for Duke
branch Level 6: Delete
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 Owen! Maybe you should explore ways to improve your code abstractions.
@Override | ||
public void print(){ | ||
if (this.isDone) { | ||
System.out.println("[D][\u2713] " + description + " (by: " + by + ")"); |
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 you should avoid the need of magic strings here...
} | ||
@Override | ||
public String getType() { | ||
return "E"; |
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.
refer to the magic strings comment.
src/main/java/duke/items/Task.java
Outdated
private static int numOfTasks = 0; | ||
protected String description; | ||
protected boolean isDone; | ||
protected static ArrayList<Task> list = new ArrayList<Task>(); |
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 this variable should be called listOfTasks?
this.description = description; | ||
} | ||
public String getType() { | ||
return "T"; |
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.
refer to the magic strings comment.
src/main/java/duke/main/Utils.java
Outdated
ArrayList<Task> buffer = Task.getList(); | ||
switch (buffer.get(i).getType()) { | ||
|
||
case ("T"): |
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.
refer to the magic strings comment (maybe use enums here?).
src/main/java/duke/main/Utils.java
Outdated
switch (buffer.get(i).getType()) { | ||
|
||
case ("T"): | ||
fw.write(buffer.get(i).getType() + "\t" + buffer.get(i).isDone() + "\t" + buffer.get(i).getDescription() + "\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.
maybe you should consider improve your code abstraction here. Please check SLAP hard for example. You have fw.write repeated for each case statement.
src/main/java/duke/main/Utils.java
Outdated
} | ||
|
||
public static void loadTask(String line){ | ||
String[] arr = line.split("\t"); |
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 assign arr[0],arr[1],arr[2],arr[3] variable names in order to improve the code's readability?
src/main/java/duke/main/Utils.java
Outdated
writeToFile(); | ||
return -1; | ||
|
||
case ("list"): |
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.
refer to the magic string comment.
src/main/java/duke/main/Utils.java
Outdated
} | ||
System.out.println("Got it. I've added this task: "); | ||
String item = line.substring(indexOfSpace + 1, indexOfSlash - 1); | ||
String extra = line.substring(indexOfSlash + 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.
maybe we should have some code comments here explaining the logic behind +1,-1,+4?
branch-Level-8
# Conflicts: # list.txt # src/main/java/duke/items/Event.java # src/main/java/duke/items/Task.java # src/main/java/duke/main/Parser.java # src/main/java/duke/main/UI.java
Branch level 9
# Conflicts: # list.txt # src/main/java/duke/items/Event.java # src/main/java/duke/items/Task.java # src/main/java/duke/main/Parser.java # src/main/java/duke/main/UI.java
Branch a java doc
Basic features user guide
No description provided.