jmjatlanta / komodo

Komodo
https://komodoplatform.com/
Other
0 stars 0 forks source link

Replace globals with domain-specific structs #15

Open jmjatlanta opened 3 years ago

jmjatlanta commented 3 years ago

Globals are convenient, but lead to problems in maintainability.

The Concept

Divide the globals into structures that are shared with the components that need them. Example (divisions and names will change):

Why go through all this?

Dividing the globals into these structures provides

The over-reaching goal is to develop components that have a well-defined interface and push complexity to lower layers (Why are main.cpp and init.cpp so big? Because the complexity is in the wrong place.).

jmjatlanta commented 3 years ago

This could be considered an expansion of the CChainParams struct and Params() function. Note how Params() can be manipulated to make testing possible.