Skip to content

Conversation

@chiarazarrella
Copy link
Contributor

@chiarazarrella chiarazarrella commented Apr 11, 2025

related to #262

The goal is to add a new comment for the analyzer

@@ -0,0 +1,4 @@
# Reuse code from Describe two params

The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual methods `describe(Character)`, `describe(Destination)`, `describe(TravelMethod)`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggestion for slight rewording and I don't think the describe(TravelMethod) is needed here.

Suggested change
The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual methods `describe(Character)`, `describe(Destination)`, `describe(TravelMethod)`.
The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual `describe(Character)` and `describe(Destination)` methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think the describe(TravelMethod) is actually needed. In fact, the method describe(Character, Destination) can be implemented in two ways:

  1. public String describe(Character character, Destination destination) {
    return describe(character, destination, TravelMethod.WALKING);
    }

  2. public String describe(Character character, Destination destination) {
    return describe(character) + describe(destination) + describe(TravelMethod.WALKING);
    }

Without referring todescribe(TravelMethod), the student may think that one solution is also:

public String describe(Character character, Destination destination) {
return describe(character) + describe(destination) + "You're traveling to your destination by walking.";
>}

Also in design.md, they suggest to indicate it.

Copy link
Member

Choose a reason for hiding this comment

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

Oops, you're right! The describe(TravelMethod) is needed here.

@@ -0,0 +1,4 @@
# Reuse code from Describe two params

The `describe(Character, Destination)` method should reuse the logic implemented in `describe(Character, Destination, TravelMethod)` or in the individual methods `describe(Character)`, `describe(Destination)`, `describe(TravelMethod)`.
Copy link
Member

Choose a reason for hiding this comment

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

Oops, you're right! The describe(TravelMethod) is needed here.

@kahgoh
Copy link
Member

kahgoh commented May 18, 2025

Looks good to me now.

+cc @exercism/guardians

@SleeplessByte SleeplessByte merged commit 7b6c437 into exercism:main May 19, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

track/java Java track type/analyzer-comments Analyzer comments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants