Another software design question: program-level globals
Ben Finney
bignose-hates-spam at and-benfinney-does-too.id.au
Fri Feb 13 16:43:25 EST 2004
More information about the Python-list mailing list
Fri Feb 13 16:43:25 EST 2004
- Previous message (by thread): Another software design question: program-level globals
- Next message (by thread): Another software design question: program-level globals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 13 Feb 2004 18:43:54 GMT, Robin Munn wrote: > OK, here's another software design question, one that's been bugging > me for a while now. What do y'all think is the best way to handle > program-level globals, such as configuration option -- especially in > multi-module programs? The first thing to do is: don't use globals. The interface between disparate parts of your code (functions, classes, modules, packages) should be as explicit and discoverable as possible. Often the simplest first step in eliminating globals is to wrap them up in a class (such as ConfigOptions) as class attributes. Other, more elegant solutions may require refactoring the code. -- \ "I like to go to art museums and name the untitled paintings. | `\ 'Boy With Pail'. 'Kitten On Fire'." -- Steven Wright | _o__) | Ben Finney <http://bignose.squidly.org/>
- Previous message (by thread): Another software design question: program-level globals
- Next message (by thread): Another software design question: program-level globals
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list