Saturday, January 30, 2010

fltk::Group and fun

Just working with integrating some google earth inspired controls into an application I'm working on. fltk::Group ended up causing me some confusion and grief.

- handling layout of the controls.
- handling delegation of things like "mouse wheel" to the controls.

Looking at fltk::Group, the implementation seems pretty heavy. In the simplest case a "group" should just be a bunch of widgets. Unfortunately the base class has lots of policy coded into it. As I tried to work around these policies this thought came to me:

"method overriding should either implement behavior or further explain behavior, it should never change or disable behavior."

If you find yourself in the case of overriding functions ot change or disable behavior that should be a pretty clear indication that the hierarchy is poorly designed.

No comments:

Post a Comment