Namespace, Class Naming and CMake Targets (Code Organization)
Currently the whole Library and its definitions reside in a global namespace. Following best practices for libraries, the project should create it's own namespace, such as stochastics.
#include <Stochastics/StochasticsInterface.h> // if just the interface is needed
#include <Stochastics/Stochastics.h> // if the implementation is needed
...
unique_ptr<stochastics::StochasticsInterface> = std::make_unique<stochstics::Stochastics>();
naming is hard
so we should also think about naming of the individual classes
-
stochastics::StochasticsInterface
→stochastics::Interface
? -
stochastics::Stochastics
→stochastics::StochasticsImpl
,stochastics::Implementation
?
testing is prime
In mantle, we also provide mocks for all interfaces (googlemock).
This would be trivial, but then the implementation can be easily tested, mocked, etc...
In mantle this mocks are just available if we use the cmake target mantle_api::Mocks
changes w.r.t the naming and also the public cmake targets could be made
target_link_libraries(YOUR_TARGET Stochastics::Interface) # interface only
target_link_libraries(YOUR_TARGET Stochastics::Implementation) # implementation only
target_link_libraries(YOUR_TARGET Stochastics::Stochastics) # interface + implementation
target_link_libraries(YOUR_TARGET Stochastics::Mocks) # testing mocks