Why avoid mocks

Firstly, the “verb/noun” distinction has a root in OOP and I believe it is not relevant in Elixir, mocking or not.

Secondly, José’s article is bringing the options of stubs (changing them in the configuration) and testing the real thing. (There is a discussion about the difference of mocks [the "nouns] and stubs, but that is not important here).

So again, what are we testing when we change MyApp.Twitter.HTTPClient to MyApp.Twitter.InMemory? The latter uses an implementation that is in fact the same as something I define in a mocking library, only adding my own potential bugs.

The article talks about dependency injection - which is based on “interfaces” in other languages and is re-defined as “protocols” in Elixir. Both are OO concepts. I never liked dependency injection because it changes the design of a program to accomodate testing. In the functional paradigm we should aim at modules/functions that are free of side effects and dependency injection is a side effect.

One of the weaker points of Elixir is the (getting closer relationship) to Ruby (on Rails) which are a OO language (and an OO framework), Ruby itself is an hybrid language at best. Look at the re-assignment of variables (which is just a workaround of immutability) and the compiler warnings in 1.3 of Elixir for certain use cases.