| > I strongly disagree on the global variable side though... My thinking is that software has been terrible (over-complex) for such a long time, so its time to start questioning our most dogmatic principles, such as "global variables are bad". Imagine you can instantly see all the dependencies to/from every global variable whenever you select it. This mitigates most of the traditional complaints. I would argue that adequate tooling that allows for this would dramatically simplify all development. It's the only thing that matters and its so absent from every development platform/language/workflow. If we could only see what was going on in our programs, we would see the complexity, and we could avoid it. Another related bit of dogma is _static scoping_. Why does a function have to explicitly state all its arguments? Why aren't we allowed to access variables from anywhere higher up in a call stack? What you realize is that all of these rules are so you can look at plain text code and (kind of) see what is going on. This is a holdover from low-powered computers without GUIs like most of programming. Even if an argument is explicit, if its passed down via 10 layers, you still have to go look. |
Having code be tree like or at least a DAG is how you resolve what is probably most easily visualized as dependency hell.
This is why many modern patterns try and steer people into having their domain logic centered and compromised of idempotent functions.
And while they didn't know why back then, it is why accounting has used immutable events for over 500 years.
The notion of free variable is another lens to think about it.