Skip to content

[#766] New practice exercise circular-buffer #775

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 7 commits into from
Jun 26, 2021

Conversation

jiegillet
Copy link
Contributor

One more.

I know I'm overdoing it a little, I have time off this week. I get kind of addicted to these kinds of problems, and if me solving them can help out... 😅

No rush for the review, please take your time.

@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 (reputation/contributed_code/{minor,major})? (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 🤖.

@jiegillet jiegillet changed the title [#766] New practice exercise circular-buffer [#766] New practice exercise circular-buffer Jun 21, 2021
@neenjaw
Copy link
Contributor

neenjaw commented Jun 22, 2021

Nice work! This week is a bit busy for me, will try to review by this weekend at the latest

@jiegillet
Copy link
Contributor Author

Thank you and please take your time. I have a week off so I'm enjoying my free time.

Comment on lines 43 to 48
operations = [
%{"item" => 1, "operation" => "write", "should_succeed" => true},
%{"expected" => 1, "operation" => "read", "should_succeed" => true}
]

Enum.each(operations, &test_operation(buffer, &1))
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 it might be better for students if the whole test suite was a little bit less DRY and a bit more explicit. Something like this, so you don't need to go back to the top of the file to see the expected result:

Suggested change
operations = [
%{"item" => 1, "operation" => "write", "should_succeed" => true},
%{"expected" => 1, "operation" => "read", "should_succeed" => true}
]
Enum.each(operations, &test_operation(buffer, &1))
assert CircularBuffer.write(buffer, 1) == :ok
assert CircularBuffer.read(buffer) == {:ok, 1}

Especially for beginners, seeing this list of maps with operations might be confusing.

Otherwise, in a non-teaching context, this would be all fine by me :)

"errors"
],
"practices": [
"processes",
Copy link
Member

Choose a reason for hiding this comment

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

Woohoo, we needed more exercises that practice processes 💜

],
"practices": [
"processes",
"errors"
Copy link
Member

Choose a reason for hiding this comment

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

@neenjaw Do you remember how we defined practicing/requiring "errors"? Is it about the ok/error-tuple pattern, or is it about using raise (exceptions is definitely about defining custom ones)?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it is implemented to exercise raise

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not opposed to this addition though, it is an accepted way of handling errors

Copy link
Member

@angelikatyborska angelikatyborska left a comment

Choose a reason for hiding this comment

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

Looks great to me, but let's wait a few days to see if @neenjaw wants to add anything

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.

4 participants