dwyl / dwyl/phoenix-ecto-append-only-log-example
Do we need behaviours?
- Dominant language
- Elixir
- Stars
- 82
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
The example is using behaviours to define the structure of the API interface:
https://github.com/dwyl/phoenix-ecto-append-only-log-example/blob/e8eee00fab8f1555ab93c2d2757c497207d81873/lib/append/append_only_log.ex#L9-L14
The implementation of the API is then done in the `before_compile` macro:
https://github.com/dwyl/phoenix-ecto-append-only-log-example/blob/e8eee00fab8f1555ab93c2d2757c497207d81873/lib/append/append_only_log.ex#L25-L48
...
However I'm not sure behaviours are needed for the append only example.
From my understanding it makes sense to use behaviours when multiple modules need to provide the same functions but with a different logic of implemention. In our example only the `AppendOnlyLog` module is implementing the behaviours.
For a learning purpose it makes sense to see how behaviours works :+1: but I'm not sure if they provide a lot of values for this repository?
Should we still keep them to demonstrate how they can be used?
ref: https://elixir-lang.org/getting-started/typespecs-and-behaviours.html#behaviours
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.