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

[Nicholas Nge] iP #257

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

Conversation

nicholasnge
Copy link

No description provided.

@nicholasnge nicholasnge changed the title Nicholas Nge iP [Nicholas Nge] iP Feb 2, 2021
Copy link

@chanellNg chanellNg left a comment

Choose a reason for hiding this comment

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

Overall, the indentation was very consistent and comments were very informative, though some may be a bit lengthy. Naming was consistent and clear.

}

/** Creates a new Deadline
* @param ui helper to interact with user

Choose a reason for hiding this comment

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

Maybe there should be an empty line between the method description and parameter section


/** Creates a new Event
* @param ui helper to interact with user
* @param tasks we add the new created event here

Choose a reason for hiding this comment

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

Perhaps could add punctuation behind each parameter description

Copy link
Author

Choose a reason for hiding this comment

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

good idea, thanks

ui.showFormatException("FindCommand");
}
return new EmptyCommand();
}

Choose a reason for hiding this comment

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

maybe can stick with } else { indentation, comment can be moved up

Copy link

@GJ0407790 GJ0407790 left a comment

Choose a reason for hiding this comment

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

Overall, the code is clean and easy to understand.
Just a few things to take note of:

  1. class field should be after the class header.
  2. remember to add a space before "{" in class header.
  3. For the package name, can consider put it all under one big package. eg duke.command, duke.oracle.

Comment on lines 24 to 25
Task t = tasks.get(this.taskIndex);
tasks.remove(this.taskIndex);

Choose a reason for hiding this comment

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

Task t = tasks.remove(this.taskIndex)

I think can make this simpler by combining both statements.

Copy link
Author

Choose a reason for hiding this comment

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

good idea, thanks

import oracle.TaskList;
import oracle.Ui;

public class EmptyCommand implements Command{

Choose a reason for hiding this comment

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

Can have a space after between Command and {

/**
* @param ui helper to print the new deleted task
* @param tasks we call delete on the indicated task in this TaskList
* @return true

Choose a reason for hiding this comment

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

Can explain why the method always returns true. eg So that duke can continue accepting commands. (I understand this after reading the ExitCommand)

Copy link
Author

Choose a reason for hiding this comment

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

will do, thanks

public boolean execute(Ui ui, TaskList tasks) {
ArrayList<Task> results = new ArrayList<>();
for (Task t : tasks.getTasks()) {
if (t.toString().contains(this.keyword)) {

Choose a reason for hiding this comment

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

I think can give a variable to t.toString() to explain whether this is the task description or the string representation of the task.

return res;
}

LocalDateTime deadline;

Choose a reason for hiding this comment

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

This field should be right after header?

Copy link
Author

Choose a reason for hiding this comment

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

yup, thanks for pointing it out

@@ -0,0 +1,54 @@
package entry;

public class Task {

Choose a reason for hiding this comment

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

Add a header comment to describe the use of this task.
I think can declare Task as an abstract class since there is no Task instance.

return new EmptyCommand();
} else if (split[0].equals("find")) {
try {
String kw = split[1];

Choose a reason for hiding this comment

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

Can give a more descriptive name, ie what does kw stands for?

* @param input this is the raw String given by the user
* @return a Command
*/
public Command parse(String input) {

Choose a reason for hiding this comment

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

Is this method a bit too lengthy, can consider extract out the common part of the code.

FileWriter myWriter = new FileWriter(filePath);
for (Task task : tasks){
myWriter.write(task.toStorage()+ '\n');
}

Choose a reason for hiding this comment

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

This indentation is off.

Copy link
Author

Choose a reason for hiding this comment

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

sorry, how is it off? i cant see it

String[] sorted = s.split("\u001E");
Boolean isDone = sorted[1].equals("T");
try{
switch (sorted[0]) {

Choose a reason for hiding this comment

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

Add a default case as specific in textbook.

Copy link
Author

Choose a reason for hiding this comment

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

yup thanks

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.

3 participants