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

[ishitamandal06] iP #71

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

Conversation

ishitamandal06
Copy link

No description provided.

Copy link

@AaaaaronC AaaaaronC left a comment

Choose a reason for hiding this comment

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

neat code, good job!

System.out.println("\t"+(i+1)+". "+ inputs.get(i) );
}
System.out.println("____________________________________________________________");
}

Choose a reason for hiding this comment

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

the ' else{ ' line should be on this line instead of the next line

Comment on lines 34 to 35
for(int i=0;i< inputs.size();i++){
System.out.println("\t"+(i+1)+". "+ inputs.get(i) );

Choose a reason for hiding this comment

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

Might want to include one space character for example "int i = 0 ; i < inputs.size() ; i++"

for(int i=0;i< inputs.size();i++){
System.out.println("\t"+(i+1)+". "+ inputs.get(i) );
}
System.out.println("____________________________________________________________");

Choose a reason for hiding this comment

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

this line makes the code look long and messy, maybe can be replaced with a helper function defined above

String inputText = "";
List<String> inputs = new ArrayList<>();
boolean isRunning = true;
while(isRunning){

Choose a reason for hiding this comment

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

spaces can be put in between like so: "while (isRunning) { "

"\tadded: "+inputText +"\n"+
"____________________________________________________________\n");
}

Choose a reason for hiding this comment

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

unnecessary empty line here

else{
inputs.add(inputText);
System.out.println("____________________________________________________________\n" +
"\tadded: "+inputText +"\n"+

Choose a reason for hiding this comment

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

good that the string is segmented to avoid overly long lines of code. however, indents can be made to align the string to make it more readable

Copy link

@xseh xseh left a comment

Choose a reason for hiding this comment

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

Good effort! Please consider making the entire code more readable with more SLAP, following the coding standards (take note of spacings) and avoiding complicated expressions as well as magic numbers.

@@ -0,0 +1,14 @@
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.

The code does not comply with coding standards, perhaps you can consider adding space between Task and {.

Comment on lines 42 to 46
} else if (arr[0].equals("deadline")) {
tasks[taskCount++] = new Deadline(inputText.substring(9,inputText.indexOf('/')),inputText.substring(inputText.indexOf('/')+4));
}else {
tasks[taskCount++] = new Event(inputText.substring(6,inputText.indexOf('/')),inputText.substring(inputText.indexOf('/')+4));
}
Copy link

Choose a reason for hiding this comment

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

Avoid complicated expressions. Consider abstracting the details into other functions or break down the logic into mutiple statements. Please take note of the length of the code and avoid long methods.

Comment on lines 54 to 56
int position = Integer.parseInt(inputText.substring(inputText.length()-1));
if ((inputText.substring(0,4).equals("mark"))){
tasks[position-1].markAsDone();
Copy link

Choose a reason for hiding this comment

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

Avoid using magic literals. Consider putting the numbers into variables to make the code more easily understood. For example, 0 can be put iinto a variable STARTING_INDEX_OF_COMMAND_STRING.

tasks[position-1].markAsDone();
System.out.println("Nice! I've marked this task as done:");

}else{
Copy link

Choose a reason for hiding this comment

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

The code does not comply with the coding standards. Please consider adding spaces between }, else and {.

Comment on lines 72 to 78
if(inputText.equals("bye")) {
isRunning = false;
showExitMessage();
} else if (inputText.equals("list")) {
handleListMessage();
}else if ((inputText.substring(0,4).equals("mark")) || inputText.substring(0,6).equals("unmark") ) {
handleMarkMessage();
Copy link

Choose a reason for hiding this comment

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

The code can be further improved with more abstraction (SLAP).

}

public String getStatusIcon() {
return (isDone ? "X" : " "); // mark done task with X
Copy link

Choose a reason for hiding this comment

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

Avoid complicated expressions, consider seperating the logic to make the code more understandable. Also remember to remove uneeded comments after making the statements clear (i.e. comments should avoid stating the obvious).

return "[" + this.getStatusIcon()+"] " + this.description;
}

//...
Copy link

Choose a reason for hiding this comment

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

Please consider removing this comment because it serves no purpose.

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.

4 participants