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

grade-school: fix student cannot be in multiple grades logic #1819

Merged
merged 3 commits into from
Jul 14, 2021

Conversation

wolf99
Copy link
Contributor

@wolf99 wolf99 commented Jul 9, 2021

Fixes #1763, see the discussion there for explanation

@wolf99 wolf99 added x:action/fix Fix an issue x:knowledge/elementary Little Exercism knowledge required x:module/practice-exercise Work on Practice Exercises x:size/small Small amount of work labels Jul 9, 2021
Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

To me, I find this new case a0c7b9b8-0e89-47f8-8b4a-c50f885e79d1 equally as unsatisfying as the case that it reimplements c125dab7-2a53-492f-a99a-56ad511940d8 (Edit: the new case is unsatisfying, but less unsatisfying than the case it reimplements) because both of these cases can be passed by an implementation that declares this:

  • a student that is added twice shall be considered to belong to neither of the grades they were attempted to be added to.

In other words, it does not seem to me that either the added case nor the case that it reimplements distinguishes between a desired behaviour and my above-described behaviour (and I presume my above-described behaviour is not what is intended/desired by the https://github.com/exercism/problem-specifications/blob/main/exercises/grade-school/description.md).

Thus, this newly-added case cannot receive my endorsement (and thus my GitHub Approval). But since there is a valid implementation (the one I described above) that passes it, I do not declare it incorrect, so it will also not receive my refusal. If others decide this case is the best solution to #1763 and the right way forward given the problems described therein, I do not oppose that determination - in such a case, please proceed without my Approval.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

Upon review, I specifically revoke the part of my previous comment where I claim the added case is equally as unsatisfying as the case it reimplements. I now notice that the reimplemented case is a roster with a desiredGrade, which is very much against the https://github.com/exercism/problem-specifications/blob/main/exercises/grade-school/description.md.

My standard for a GitHub Approval shall be whether a change is an improvement. The added case is unsatisfying (my reasons for declaring it such are unchanged), but it is less unsatisfying than the case it reimplements. Therefore, it receives an Approval.

@wolf99
Copy link
Contributor Author

wolf99 commented Jul 10, 2021

both of these cases can be passed by an implementation that declares this:

  • a student that is added twice shall be considered to belong to neither of the grades they were attempted to be added to.

I agree that this is an issue. I will move this PR to draft and look at solutions.
Thanks @petertseng !

@wolf99 wolf99 marked this pull request as draft July 11, 2021 13:54
@wolf99 wolf99 marked this pull request as ready for review July 11, 2021 14:56
@wolf99
Copy link
Contributor Author

wolf99 commented Jul 11, 2021

I realise this still doesn't cover all all aspects of this condition. This is because the case is really an error condition for the action of adding students rather than of querying the roster property ... Fixing this will require the entire spec to be changed. I'm not averse to doing that but would like to get progress enough to fix #1763 and exercism/c#555 first though.

Copy link
Member

@petertseng petertseng left a comment

Choose a reason for hiding this comment

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

We have an interesting situation: If we wish to signal explicitly that a case in canonical-data.json is no longer recommended, we can add a case that reimplements it. But I believe this is a situation where we might simply wish for a way to signal that c125dab7-2a53-492f-a99a-56ad511940d8 is no longer recommended and not provide a case that reimplements it. But we have no way to do that. I'll continue to Approve any valid and consistent cases that improve the situation. These two cases fit that criterion. Perfection isn't a requirement.

The reason I wished for a way to not provide a replacement has already been pointed out - we don't currently have a good way to be clear about the fact that this is an error that should happen at add time, not at query (roster/grade) time. We could:

  1. Use a different property to signal that
  2. Just put an error in the roster cases and expect tracks to do what makes the most sense for them
  3. Choose not to specify any such cases in this canonical-data.json at all
  4. Other solution I didn't think of

And, since c125dab7-2a53-492f-a99a-56ad511940d8 exists, doing 3 involves a way to signal its un-recommendation.

Note that we used to have a similar problem for bowling - if there are any invalid rolls, the errors should be signaled at roll time, not score time. This had to be fixed in #536.

@wolf99 wolf99 requested review from bergjohan, coriolinus, iHiD and kotp and removed request for bergjohan July 11, 2021 19:03
exercises/grade-school/canonical-data.json Outdated Show resolved Hide resolved
Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
@ErikSchierboom
Copy link
Member

And, since c125dab7-2a53-492f-a99a-56ad511940d8 exists, doing 3 involves a way to signal its un-recommendation.

Note that we used to have a similar problem for bowling - if there are any invalid rolls, the errors should be signaled at roll time, not score time. This had to be fixed in #536.

Interesting problem. We indeed don't have a way to signify this "just don't use this test case anymore" scenario. Will perhaps be useful in the future. The only thing thats I could come up with are:

  • Add comments (which don't show up in tests.toml files)
  • Add a suffix to the title (which does show up in tests.toml files)

@SleeplessByte SleeplessByte merged commit 108e806 into main Jul 14, 2021
@SleeplessByte SleeplessByte deleted the grade-school branch July 14, 2021 22:44
@SleeplessByte
Copy link
Member

Thanks @wolf99. I like the new canonical data, and thanks everyone else for chiming in.

@wolf99 wolf99 mentioned this pull request Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:action/fix Fix an issue x:knowledge/elementary Little Exercism knowledge required x:module/practice-exercise Work on Practice Exercises x:size/small Small amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

grade-school test for student in multiple grades does not make sense
5 participants