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

[T4A1][T01-T3] Teo Shu Qi #91

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

[T4A1][T01-T3] Teo Shu Qi #91

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jul 1, 2017

No description provided.

@Override
public String getPrintableString() {
return LABEL + this.toString();
}

Choose a reason for hiding this comment

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

Shouldn't you check if it's a private or not? The variable name LABEL is too generic.

@@ -83,5 +83,22 @@ public int hashCode() {
public String toString() {
return getAsTextShowAll();
}

private String addDetailToDetailsString(String details, String detail) {

Choose a reason for hiding this comment

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

No need to create a new method for this. Also the method name is quite confusing. :)

*/
private String getPrintableString(Printable ... printable) {
String details = "";
for ( Printable detail :printable) {

Choose a reason for hiding this comment

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

Pay attention to the white space.

private String getPrintableString(Printable ... printable) {
String details = "";
for ( Printable detail :printable) {
addDetailToDetailsString(details, detail.getPrintableString());

Choose a reason for hiding this comment

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

You might use java collection method, like String.join or StringBuilder.

}

/**
* Print out the details of the person requested.

Choose a reason for hiding this comment

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

This method doesn't print anything.

/**
* Print out the details of the person requested.
* @param printable
* @return a concatenated version of the printable strings of each object.

Choose a reason for hiding this comment

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

You can remove @return and write Returns ... as the description.

public interface Printable {

// Label stating what detail is this detail (e.g. Phone: )
public static String LABEL = "";

Choose a reason for hiding this comment

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

No need to define it here.

@jeffryhartanto
Copy link

@teoshuqi
Some comments added. Please close the PR after reading comments. Clean PR, good job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants