in reply to How to write effective modules

Having one and only one piece of data that is shared by many modules is rarely a problem. In effect, that one-and-only-one is functioning as an "application object". However, most programs of any real size don't stay that way.

The thing to watch out for is when you find multiple bits of data are always being passed together to functions. When that starts happening you need to encapsulate the things that get passed around together into a single object. Then instead of passing several parameters and having to remember what order you usually use to pass them, you can pass one single parameter that gives access to all the other information.

The other thing to watch out for is things that change together. If setting one variable causes ripple effects in other variables, the thing that changes and all the variables affected by it should normally be encapsulated into a single object. Sometimes you may find that A triggers changes in B1,B2,B3 and B3 triggers changes in X,Y,Z. In that case you may need two objects:

Best, beth