inaka / erlang_guidelines

Inaka's Erlang Coding Guidelines
Apache License 2.0
620 stars 122 forks source link

No implicit included functions when using mixer #59

Closed jfacorro closed 6 years ago

jfacorro commented 8 years ago

No implicit included functions when using mixer

Don't implicitly include all functions from a module when using the mixer library. Explicitly list all mixed-in functions.

%% bad
-mixer([some_module]).

%% good
-mixin(
  [ { some_module,
      [ check_user/3
      , validate_user/2
      , authorize_user/2
      ]}
  ]).

Reasoning: Knowing all the functions that are included in a module makes it easier to reason about it. If any number of functions are implicitly brought from another module, it introduces an extra level of unnecessary indirection that requires jumping back and forth between files. The less information we have to keep in our heads the better.


elbrujohalcon commented 8 years ago

:+1:

igaray commented 8 years ago

:+1: :+1: