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

Add a page tutorial explaining how to write a sorter adapter #154

Closed
Morwenn opened this issue Aug 16, 2019 · 1 comment
Closed

Add a page tutorial explaining how to write a sorter adapter #154

Morwenn opened this issue Aug 16, 2019 · 1 comment
Milestone

Comments

@Morwenn
Copy link
Owner

Morwenn commented Aug 16, 2019

Writing an adapter isn't exactly an easy task, so having a tutorial with code would help, especially to avoid having to include a full example of how adapter_storage works in its documentation. Now the issue will be to find an example with a simple enough adapter which isn't 100% useless either.

@Morwenn
Copy link
Owner Author

Morwenn commented Apr 21, 2022

Good example of a sorter adapter: one that shuffles the input before sorting the collection. The technique is mentioned in this article as a way to prevent Hyrum's law: with a sufficient number of users, someone will inevitably end up relying on observable yet non-guaranteed properties of algorithms, for example the order of elements that compare equivalent. A simple way to break tests relying on such a property is to randomize the order of elements prior to sorting, which can be desirable with a debug option.

A randomizing_adapter would therefore be a simple yet interesting example to demonstrate how to write a sorter adapter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant