Skip to content

Implementation of analyzer for wizards-and-warriors-2 #262

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

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

Conversation

chiarazarrella
Copy link

@chiarazarrella chiarazarrella commented Apr 11, 2025

Implementation and testing of the analyzer for the concept exercise wizards-and-warriors-2.

Closes #116

ToDo:


/**
* @author: chiarazarrella
*/
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need to tell students to use method overloading - the exercise has been designed so that the GameMaster.describe must be overloaded. So, all passing solutions should already be using method overload to pass.

Copy link
Member

Choose a reason for hiding this comment

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

Looking at your tests for the "not use", "partial" and "use string format not use" method overloading, I'm a little confused into how method overloading isn't being used in their samples because the describe method is overloaded (defined multiple times, with different parameter types). Did you mean reuse method?

Copy link
Author

@chiarazarrella chiarazarrella Apr 11, 2025

Choose a reason for hiding this comment

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

Oh! I see; what I meant was to exploit method overloading and yes, it is done indeed by reusing the methods.

However, I have noticed that it already exists something similar, the reuse_code comment. Should this be used instead? Or is it enough to only modify the name of the comment from use_method_overloading to reuse_method?

Copy link
Member

Choose a reason for hiding this comment

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

I think, if we can, we should use the same reuse_code comment. The comment needs to be specific about which describe method it should use though because all the methods are named describe. I'd suggest including the parameter's type in the comment. For example:

The describe(Character, Destination) method should reuse the logic implemented in describe(Character, Destination, TravelMethod). Reusing existing methods can help make code easier to maintain.

The methods can be passed as parameters to the comment (see AnalyzerIntegrationTest.loglevels.NoReuseOfBothMethods.approved.txt for an example).

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.

wizards-and-warriors-2: implement analyzer
2 participants