A theory of modern Golang
In other words, use a pure dependency-injection style, and ZERO globals.<p>I&#x27;m writing Python and some C++, and I have been doing this for maybe 5-6 years.  It takes a little practice to structure your programs like this, but once you know how, it has a lot of benefits.<p>It&#x27;s not really idiomatic in those communities either.  Python and C++ Libraries use globals all the time, although I think it&#x27;s becoming less common.<p>I guess Java programmers have been doing dependency injection for even longer.  It probably became popular more than 10 years ago.  But I&#x27;m not really sure how &quot;pure&quot; the Java ecosystem is.  Singletons are banned under this style.  Instead, a singleton is just an object you instantiate once in main(), and pass throughout the rest of your program.<p>I think the problem with Java is lack of free functions.  Static methods confuse things too.<p>The pure-dependency injection style is basically <i>functional programming</i>, requiring state as an explicit parameter.