I have been listening to Klaus Iglberger speech on CppCon 2017 called "Free Your Functions" (you can find it on Youtube here: https://www.youtube.com/watch?v=WLDT1lDOsb4) which exposes better the rationale behind a concept coming from the Effective C++ book guideline: "Prefer non-member non-friend functions to member functions".
Looking at all the advantages and disavantages, there is one disavantage that is puzzling me very badly, which is: you do not call those functions using the operator.
, and they are free to be defined anywhere.
Reading this article about The Interface Principle, which talks extensively about what should to be considered a class public interface (http://www.gotw.ca/publications/mill02.htm), its pretty much clear to me that those free functions are part of the class interface, even if it happens that they can be defined in any file anywhere in the project.
Why is it a disadvantage? Because in my experience, scattering the code around in big projects will cause code duplication, as developers have no way to be aware that some utility function has already been implemented for that class, and they will code it again. And that is something that does not happen when you use operator.
to call a function on an object, not only because member function are forced by the language itself to be declared in the same file where the class is declared, but also simply because IDEs usually pop-up a list of the already available member functions as you press the ".".
So the question is: assuming The Interface Principle to be right, and assuming the free function approach to be a good coding guideline, in order to get rid of the disadvantage of people not finding already written free functions for a class, would it be technically possible for IDEs to help developers showing the whole class public interface and not only the class members? Or would it be computational overwhelming or even unrealizable in practice?