You don't want to do it like that....

During some simple refactoring today, a phase of ‘restricting access to data members’, I discovered an interesting little design ‘descision’. In the spirit of completely mixing up the business logic and the display logic we have a data member that represents a colour that an object uses as its background colour when it is displayed in a grid. The colour is set depending on the state of the object; error, ok, new, complete, etc. This wouldn’t be too much of an issue but it’s also used to test for the object state. We have lines of code that do things like “if (object->colour == ObjectInErrorColour)” do error handling stuff.

Lets hope that nobody decides to make the display colours configurable…

This one has gone on the list of things to fix later. The refactoring involved is non-trivial and needs some planning.