Skip to content

Sync: re-write grade-school #1050

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

Merged
merged 3 commits into from
Jan 31, 2022
Merged

Conversation

jiegillet
Copy link
Contributor

This one was a bit involved. The requirements and API changed quite a lot, so I decided to re-write the whole test suite. Here are the main changes I made

  • The data structure for the school used to be a map, but I changed it so that the student may implement whatever @type school they prefer, and the tests don't assume a specific data structure.
  • This mean I had to add School.new/0.
  • add used to return a school, but the new tests needed to know if a student insertion was allowed, so now it returns {:ok | :error, school}.
  • This means I had to add atoms and tuples to the prerequisites.
  • I joined some tests that checked the results (list of :ok | :error) and the roster separately for the same data.

@jiegillet jiegillet added the x:size/large Large amount of work label Jan 30, 2022
@github-actions
Copy link
Contributor

Thank you for contributing to exercism/elixir 💜 🎉. This is an automated PR comment 🤖 for the maintainers of this repository that helps with the PR review process. You can safely ignore it and wait for a maintainer to review your changes.

Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:

  • General steps

    • 🏆 Does this PR need to receive a label with a reputation modifier (x:size/{tiny,small,medium,large,massive})? (A medium reputation amount is awarded by default, see docs)
  • Any exercise changed

    • 👤 Does the author of the PR need to be added as an author or contributor in <exercise>/.meta/config.json (see docs)?
    • 🔬 Do the analyzer and the analyzer comments exist for this exercise? Do they need to be changed?
    • 📜 Does the design file (<exercise>/.meta/design.md) need to be updated to document new implementation decisions?
  • Practice exercise changed

    • 🌲 Do prerequisites, practices, and difficulty in config.json need to be updated?
    • 🧑‍🏫 Are the changes in accordance with the community-wide problem specifiations?
  • Practice exercise tests changed

    • ⚪️ Are all tests except the first one skipped?
    • 📜 Does <exercise>/.meta/tests.toml need updating?

Automated comment created by PR Commenter 🤖.

@@ -5,24 +5,33 @@ defmodule School do
Each student is in a grade.
"""

@type school :: :dummy_type
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a convention we have established anywhere else?

I don't recall it myself and this might not be intuitive to student approaching the problem.

So I think 3 options:

  • initial type is any()
  • specify the underlying data structure
  • don't use a defined type and just use any() in the typespec

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 I have seen this but I can't find it, maybe it was a different track...
First option sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x:size/large Large amount of work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants