by inetknght · 3y ago · 0 comments
``` #include "servicelib.hpp" int main(int argc, char argv) { return servicelib{argc, argv}.run(); } ```
The library can be re-used in other apps or services.
Then the whole damn library is unit-testable with any arguments you throw at it. Got an OS where argv may be null? You can unit test that. Got a user who decided to use --iamstupid instead of --iamawesome? You can unit test that too. Want to set up environment variables? Well that's not thread safe, but your test harness can do it before it instantiates the library object.
Want to use semver? You can. I use git commit checksums for versions and automatic tagging to semver. It's more annoying but superawesome.
However, ensuring thread safety can sometimes be a challenge. =)
I recently picked up a subscription to undo.io and I figure the next time I see any problem then I'll take that for a spin. I've seen trouble with gRPC and trying to debug it is infuriating.
I wish they used Erlang/Elixir/Phoenix channels to reduce the system complexity,
https://dev.to/codecast/how-to-use-phoenix-channels-18k9
Sometimes we just need to keep a system running, and quietly replace it with version 2 later... Yet later usually never arrives... lol =)
That said, the lib first approach was made a goal in clojure land, and sometimes it adds some choice/integration fatigue.