Where programs should store their options? Sometimes it is said that
global variables are bad, but what is better? Some huge structure
storing all options? Of course, they can be divided into many
structures or they can be passed on a stack instead of passing pointer
to structure but it is not effective.

Here is citation from TAOUP
(http://www.catb.org/esr/writings/taoup/html/ch04s06.html):
"
Here are some questions to ask about any code you work on that might
help you improve its modularity:

  * How many global variables does it have? Global variables are
    modularity poison, an easy way for components to leak information
    to each other in careless and promiscuous ways. 
  * Do any of your APIs have more than seven entry points? Do any of
    your classes have more than seven methods each? Do your data
    structures have more than seven members?
"

So lots of global variables are bad, but saving them in a local
structure is bad too? Is there any other other solution?


Reply via email to