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

Shen Zheqi #59

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

Conversation

zheqis12138
Copy link

No description provided.

Copy link

@ChengYoghurt ChengYoghurt left a comment

Choose a reason for hiding this comment

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

Goooooooooood WOWWWWWW

+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
printWelcomeMessage();
Task[] taskLists = new Task[100];

Choose a reason for hiding this comment

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

Plz avoid using the magic number~


while(!userInput.equals("bye")){
String[] userInputSplit = userInput.split(" ");
switch(userInputSplit[0]){

Choose a reason for hiding this comment

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

Good job on using correct indent on Switch!

@@ -0,0 +1,26 @@
public class Task {
private boolean isDone;
String description;

Choose a reason for hiding this comment

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

Yea can add the public label on it~

String description;
public static int numOfTasks = 0;

public Task (String description){

Choose a reason for hiding this comment

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

Good getter toc control the access to attr!

Copy link

@Yikai-Cao Yikai-Cao left a comment

Choose a reason for hiding this comment

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

LGTM, almost. Just a few nits to fix.


String userInput = getUserInput();

while(!userInput.equals("bye")){

Choose a reason for hiding this comment

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

Explicit use of switch


public static void printEchoInput(String userInput){
String echoInput =
" ____________________________________________________________\n"

Choose a reason for hiding this comment

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

Maybe you can separate the print of the line

System.out.println(" ____________________________________________________________");
System.out.println(" Here are the tasks in your list:");
String isDoneNotation;
for (int i=0; i<count; i++){

Choose a reason for hiding this comment

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

i = 0; i < count , maybe more spaces

public static void printWelcomeMessage() {
String welcomeMessage =
" ____________________________________________________________\n"
+ " Hello! I'm Duke\n"

Choose a reason for hiding this comment

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

Maybe using System.lineSeparator() is better than \n

Copy link

@mathanmahe mathanmahe left a comment

Choose a reason for hiding this comment

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

Good job! I have highlighted some coding standard violations and improvements to code quality.

}

private static void deleteTask(ArrayList<Task> taskLists, int deleteIndex) {
System.out.println(" ____________________________________________________________");

Choose a reason for hiding this comment

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

Try to avoid magic strings, if there are strings like this that need to be reused, it is good to create a constant called DIVIDER and reusing it at every occurence to improve readability.

Code Quality Guideline: Avoid Magic Literals

System.out.println(" Noted. I've removed this task:");
System.out.println(String.format(" %s", taskLists.get(deleteIndex).toString()));
taskLists.remove(deleteIndex);
Task.numOfTasks --;

Choose a reason for hiding this comment

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

No need to leave a space for post Increments as per the Java coding standard

Task.numOfTasks ++;
printEchoInput(newEvent);
}
// add exception

Choose a reason for hiding this comment

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

This seems like a reminder to yourself to add exceptions. Avoid personal comments that are private notes to yourself, instead comments should be written to the reader to improve readability. If not necessary here, can remove it altogether.

Code quality guideline: Write to the Reader

System.out.println(byeMessage);
}

// replace count

Choose a reason for hiding this comment

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

Write comments to the reader. Can remove unnecessary comments if they are not to the reader.

Coding Standard Guideline: Comment minimally, but sufficiently


String userInput = getUserInput();

while(!userInput.equals("bye")){

Choose a reason for hiding this comment

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

Since you have already declared the constant string BYE, can be reused here

deleteTask(taskLists, deleteIndex);
break;

default:

Choose a reason for hiding this comment

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

Default should have the same indent level as your other cases in switch, as per the Java coding standard.

printWelcomeMessage();
ArrayList<Task> taskLists = new ArrayList<Task>();


Choose a reason for hiding this comment

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

Avoid long methods, try to break down methods longer than 30 lines of code into smaller methods.

Code Quality Guideline: Avoid Long Methods

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