Mon, 27 Jul 2009 07:59:40 -0500, Andrei Alexandrescu wrote: >> Is it appropriate to define multiple classes, structs, templates, etc >> within a single module? What considerations should inform the decision >> regarding the placement of module boundaries? > > I think it's appropriate because many pieces of functionality come as a > bundle. The rule of thumb is, module provides the functionality, and > it's up to the designer to decide what that entails.
That's the problem. On one hand, it's desirable to see a module as a functionality bundle. On the other hand, module is the smallest available unit of encapsulation. That is, if you have a class and change its private implementation, this may affect *anything* in the same module. Hence Tango's hundreds of modules in dozens of packages, I think. It also adds to the problem that most people familiar with OO paradigm consider classes to be such encapsulation units. Surprizes are inevitable.