Entity component system

Entity–component–system (ECS) is an architectural pattern that is mostly used in game development. Main points: every entity has unique id; every logic aspect is a component - raw data linked to the corresponding entity by id; system performs actions on entities having corresponding aspects/components; diffenent components can be stored separately; systems can track entities by using observer pattern. More details can be found here.

About passing dependencies through deep call stack

Here is another approach to pass dependencies through deep call stack. In a couple of words: deeply nested code not executes immediately but returns a function for the later lazy evaluation; the correponding function accepts the required environment; at the top level call the function returned from the nested code and pass the environment to it. Documentation.