On Jan 15, 2010, at 3:06 AM, Krzysztof KosiƄski wrote:

2010/1/15 Jon Cruz <jon@...18...>:

* Can we encapsulate it? That is, do we need to leave things in .h files that other things include, or can they be moved inside specific files?

The hash set is a member of ControlPointSelection, so it has to be in
the header.

No, it doesn't.

That is a key point. At the moment there are several different approaches that *could* be used.

One common approach is to use a "pimpl". And there are others.

And keep in mind that one of the applications of STL is to be able to feed a specialized implementation of a given type to code that takes the more generic. Code that operates on a list will operate on any list, code that operates on a set will work with any set, etc. That aspect can be leveraged to encapsulate the concrete implementation used.


Once ~suv confirms that using a non-broken version of the compiler
works, I'll go back to the non-deprecated headers and add configure
code that detects the broken unordered_set. Is this acceptable?

It probably depends on API and behavior differences. We definitely would benefit from having such differences encapsulated and constrained to as few modules as possible.



So in this case of moving things from verbs.cpp to selection-chemistry.cpp I don't think the warning count decreases However, the encapsulation is much better as the cohesion goes up while the coupling goes down. The function of verbs.cpp returns to that of just dispatching commands, while all the selection magic goes over into selection-chemistry.cpp.

The problem is not that verbs.cpp uses control-point-selection.h. The
problem is that selection-chemistry.cpp is an old pile of magic stuff
that should be put in better places, and that verbs.cpp is a God-file.
Another offender in this category is widgets/toolbox.cpp.

Yes... it was a problem to add control-point-selection.h there. Prior to this, even though you may not have liked the selection-chemistry.cpp file, it was a central place to go for the implementation of selection magic. That is, it had very strong cohesion in that regards. So verbs.cpp does dispatching, and selection-chemistry.cpp does selection manipulation.
http://en.wikipedia.org/wiki/Cohesion_%28computer_science%29

Once viewed as just "a dispatcher", the intent of verbs.cpp is a bit more clear. It also can be playing the role of mediator.

http://en.wikipedia.org/wiki/Mediator_pattern

We also probably want to include the facade pattern to assist in modularity.