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

Code Structure Review #14

Open
asmodehn opened this issue Jul 24, 2021 · 2 comments
Open

Code Structure Review #14

asmodehn opened this issue Jul 24, 2021 · 2 comments

Comments

@asmodehn
Copy link
Owner

asmodehn commented Jul 24, 2021

Draw inspiration from this talk https://www.youtube.com/watch?v=fhheJ5zsXBQ. from @QuinnWilton (Big thanks for that !)
Sample phoenix app here: https://github.com/QuinnWilton/easywire

@asmodehn
Copy link
Owner Author

asmodehn commented Jul 24, 2021

Small feedback of a few months of elixir development so far:

  • behaviors and protocols can do similar things, respectively on code structure or on data structure.
  • behaviors are fine while you write "static runtime", ie code that doesnt rely on specific deployment structure (think processes deployed and layout potentially changing dynamically). They are good to start development, and easily type checked, but I couldn't find a way to scale that to "dynamic runtime" which is IMHO, the whole point of running on the BEAM.
  • when runtime start to matter during development (want resilience? scaling? and other nice BEAM things ?) then you rely on a state of the world, what is currently running on the beam (think pids for instance, or genserver's module implementation - is it a mock or not ?). To deal effectively with that runtime data, protocols will probably be more appropriate, but the extensive testing required implies property tests are needed.

This is where I am now with elixir code structure, and next step is to try replicate some of the technics from easywire in here, since it seems to be a similar kind of software....

@asmodehn
Copy link
Owner Author

Small related note: Implementation of behaviours (marked with impl: true) is not accessible by default from iex via tab-completion , as specified in the docs https://hexdocs.pm/iex/IEx.html#module-autocomplete
=> Is this a sign that behaviours are not meant for this usecase / the design is not good enough ??

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

No branches or pull requests

1 participant