Skip to content

Refactor code and update tests#2

Open
okkhoy wants to merge 1 commit into
nus-cs2113-AY2223S2:mainfrom
okkhoy:main
Open

Refactor code and update tests#2
okkhoy wants to merge 1 commit into
nus-cs2113-AY2223S2:mainfrom
okkhoy:main

Conversation

@okkhoy

@okkhoy okkhoy commented Jan 27, 2023

Copy link
Copy Markdown
Contributor

Extract method
Update test


public class Contacts0 {

public static final int MAX_ENTRIES = 100;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good job extracting the constant

@okkhoy okkhoy left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Need to do better

System.out.println("|| ===================================================");
String[][] list = new String[100][3];
showWelcomeMessage();
String[][] list = new String[MAX_ENTRIES][3];

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good job again

Comment on lines +147 to +154
private static void showWelcomeMessage() {
System.out.println("|| ===================================================");
System.out.println("|| ===================================================");
System.out.println("|| Contacts - Version 0.1");
System.out.println("|| Welcome to Contacts!");
System.out.println("|| ===================================================");
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can extract some more constants

@darrenangwx darrenangwx left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice

Comment on lines +10 to +11
showWelcomeMessage();
String[][] list = new String[MAX_ENTRIES][3];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice

Comment on lines +149 to +152
System.out.println("|| ===================================================");
System.out.println("|| Contacts - Version 0.1");
System.out.println("|| Welcome to Contacts!");
System.out.println("|| ===================================================");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nice print

}

private static void showWelcomeMessage() {
System.out.println("|| ===================================================");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Create a function to print this to reduce the use of the repeated print?

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