in reply to Is this a simple, robust, and maintainable design?

I have some thoughts and questions about ways to improve the design.

A message can have multiple independent states, such as being scanned and checked, or verified but broken, or complete but not spell checked. Is it better to keep these states in separate columns?

Perhaps columns like scan_status, check_status, and verify_status with values like PENDING, COMPLETE, NA, BROKEN. These could also be on a separate table like message_status.

Would this be a significant improvement? Does it improve simplicity, robustness, and maintainability?

  • Comment on Re: Is this a simple, robust, and maintainable design?

Replies are listed 'Best First'.
Re^2: Is this a simple, robust, and maintainable design?
by GrandFather (Saint) on Feb 03, 2011 at 20:22 UTC

    You can think about these in a couple of different ways. One way is to consider each possibility a distinct state such as VERIFIED_BROKEN, ... . That implies separate code to deal with each state.

    An alternative is to consider fundamental states (VERIFIED) and state modifying flags (BROKEN). The code then consists of handlers for each state with conditional code in the state handling code to deal with allowed modifier flags.

    If the flag handling is a small amount of code in each state handler then using flags in a flag column seems sensible. If the exceptional state handling code is significantly different than the unexceptional state code I'd do it as distinct states and use a single column.

    Either of these approaches work well with using a state machine as suggested by others.

    True laziness is hard work