-
-
Notifications
You must be signed in to change notification settings - Fork 28
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
High Scores: small redesign to use an instance variable to hold the scores #400
Conversation
…cores. A couple of additional tests to validate the returned scores are copies.
I don't know why the travis build still shows as Pending: the details end with "Done. Your build exited with 0" |
Hi @glennj. I'm back from my travel so now I have the time to go over your pull requests. Sorry you had to wait so long. I like your alternative of using an instance variable to hold state. It fits the Object Oriented paradigm better. Changing the tests to use the new API however presents a problem. The tests are designed to the same specification that all the other language tracks use. For example this test case: "cases": [
{
"description": "List of scores",
"property": "scores",
"input": {
"scores": [30, 50, 20, 70]
},
"expected": [30, 50, 20, 70]
}, The above case defines a method/function called We can add alternative solutions to our collection of exercises. In that case we could call this class The public API defined by the tests needs to stay the same as defined in the problem specification if we don't want to deviate from the rest of Exercism. I don't know if we have any flexibility to do this so I will raise another issue elsewhere to investigate this. |
This seems like a pretty fundamental difference in interpretation of the canonical data. The Ruby test suite does this: def test_list_of_scores
# skip
scores = [30, 50, 20, 70]
expected = [30, 50, 20, 70]
assert_equal expected, HighScores.new(scores).scores
end Similarly Python: def test_list_of_scores(self):
scores = [30, 50, 20, 70]
expected = [30, 50, 20, 70]
self.assertEqual(HighScores(scores).scores, expected) |
I see your point. If other language tracks are treating the problem specifications more generally then I am happy to as well. There is one more step to do. Since you are changing the tests they will need to be regenerated according to these instructions. That will create the text files for the tests that are needed for the Exercism website. Once that is done then we can get this merged. |
I think Glen has a good point, but generation will overwrite HighScoresTest. To implement Glen's idea properly will need to change the test generation. I was doing some code-generation changes PR #372 before I got busy with some other work that interrupted the flow. Wow that was a while ago. I'll see if I can refresh that next week and close out that PR, then perhaps we can consider generating tests in more OO fashion. @macta, do you have any concerns with taking the design that way? |
regenerate metadata
@samWson a side note: are you aware you have the Allergies exercise stuck in the mentor queue? https://exercism.io/mentor/solutions/92f15e6369ac49178c166b78c72adb50 |
I see. I let this exercise slide ages ago. Simply put I couldn't solve it so I moved on to other exercises but I haven't done any exercises for months now. For now I'm wanting to spend more time on this repository as it has been left alone for too long. The previous mentor was inactive so that exercise was put back in the mentor queue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok, could be merged.
@SleeplessByte: changes looks ok, but I don't see the conflicts to resolve merging PR. Can you see that? |
@Bajger yes, the problem is that they are too large, that's why you can't see them here. gh pr checkout 400 git remote add glennj https://github.com/glennj/exercism-pharo-smalltalk.git
git fetch glennj high-scores-more-OO
git switch --track glennj/high-scores-more-OO And then merge in |
I recall the main reason these PRs have languished in the queue is that the process that generates the test classes from the problem specifications was not sufficiently flexible. I think the Pharo maintainers didn't want to keep exercises up-to-date by hand. Not having pursued joining the Pharo maintainers team, I've long since given up on these changes. |
@SleeplessByte, thanks for instructions, still I can't see merge conflicts. I have following:
but if I do:
Any thoughts? Maybe to rebase commits of PR to main branch? (It seems branch was created on master long time ago). |
Yes, rebasing it will/should make the conflicts show up :) |
I don't have a write access to this branch, so I should fork from Glennj's repo and make own branch out of his branch? Or maybe adding me to .github/CODEOWNERS file would enable me to add more commits to this branch? |
@glennj : Is this exercise improvement something you'd like to discard? I can do new PR that would include these changes (I wasn't able to resolve conflicts with main). |
Oops, that was an accident. Nevertheless, if you with to pursue it, you have my blessing. |
Many of the Pharo exercises don't particularly utilize objects to hold state. This PR separates the methods to add scores from the queries.
Also a couple of additional tests to validate the returned scores are copies.