-
-
Notifications
You must be signed in to change notification settings - Fork 403
[#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
[#766] New practice exercise circular-buffer
#775
Conversation
Thank you for contributing to Based on the files changed in this PR, it would be good to pay attention to the following details when reviewing the PR:
Automated comment created by PR Commenter 🤖. |
circular-buffer
Nice work! This week is a bit busy for me, will try to review by this weekend at the latest |
Thank you and please take your time. I have a week off so I'm enjoying my free time. |
operations = [ | ||
%{"item" => 1, "operation" => "write", "should_succeed" => true}, | ||
%{"expected" => 1, "operation" => "read", "should_succeed" => true} | ||
] | ||
|
||
Enum.each(operations, &test_operation(buffer, &1)) |
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.
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:
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", |
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.
Woohoo, we needed more exercises that practice processes 💜
], | ||
"practices": [ | ||
"processes", | ||
"errors" |
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.
@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)?
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.
I think it is implemented to exercise raise
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.
I'm not opposed to this addition though, it is an accepted way of handling errors
Co-authored-by: Angelika Tyborska <angelikatyborska@fastmail.com>
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 great to me, but let's wait a few days to see if @neenjaw wants to add anything
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.