3 ms·
That is why I said you need practice writing in this style. It's quite easy to overdo it and end up with a mess. I don't think it has to an all-or-nothing thi
by chubot 9y ago
That is why I said you need practice writing in this style. It's quite easy to overdo it and end up with a mess.
I don't think it has to an all-or-nothing thing. I generally encapsulate all my state, but not all side effects, like printing to the screen.
And yes I believe logging should just be a free function. I think configuration of loggers is overrated. But if you need to use a global for that configuration, so be it.
Functions don't expose any implementation details -- they expose the state they modify and the side effects they produce.
I don't quite understand your last sentence. Dependency injection IS popular and that is what I am advocating and what this post on Go is advocating. It's perhaps not as popular in Go and Python as it is in Java, and perhaps even some corners of the C++ world.