Complex application flow. Best approach ???
- From: "Jan" <tmp02@xxxxxxxxxxxxxxxxxx>
- Date: Thu, 7 Apr 2005 00:23:07 +0200
A couple of years ago I developped an application to test
weighing-equipment. It started as something simple, but after many years of
enhancements, the whole thing has become so complicated (one big spaghetti)
that a re-design is unavoidable.
The weighing-equipment has to pass several tests (a linearity-test, a
tarra-test, a repeatibility-test, a discrimination-test, etc ...). Each
test consists of several different measurements.
Todays implementation roughly works as follows :
1. As the applications goal is to guide the inspector, and to make sure he
follows the regulations, the tests are performed in a wizard-like setup.
2. An inspection consists of several tests. The tests (each test has its
own form/screen) are shown one by one, and the sequence of the tests is
determined by the type of equipment under test, the regulations, the choice
of the inspector and efficiency.
3. A test-screen looks a bit like an spreadsheet, but with only one cell
enabled at a time. The software will jump to a first field/cell and propose
the inspector a calibrated weight to be used. Only this cel can be
modified; all other cells are disabled. The inspector can accept the
proposed value (possibly after changing) by pressing <return> or <tab>. The
current cell will be locked/disabled, the next one will be unlocked/enabled,
and the inspector is asked to enter the measured value. On pressing
<return>, the error is calculated by the software in yet another cell and
marked red or green, depending on whether it's within tolerances or not.
Then a next cell on the next line is unlocked showing a proposed calibrated
weight to be used for the next measurement...etc. This goes on untill all
required measurements have been performed, and then the next test-form will
appear. If the inspectors makes a mistake, he can return through the same
sequence of cells backwards by pressing <shift-tab> until he reaches the
cell he wants to correct
The current implementation is mainly a very big and complicated "Select case
....." switch representing the overall test sequence and calling the
individual test-forms. Each individual test-form is again a big "Select
case..." switch, which controls which cell have to be enabled/disabled, what
values have to be proposed, etc ...
Although it wasn't purposely designed as such, the whole thing looks like
very complicated state-machine, with an enormous number of
states/flows/senarios.. (the states depend on the parameters of the
equipment under test, the measurement results entered by the inspector, the
type of inspection to be performed, the local regulations which differ from
country to country, etc... but also the inspector himself has a lot of
decision in "the flow" to follow)
I'm currently looking into state-charts (Reading books like : "Practical
statecharts in C/C++ by Miro Samek" and "Constructing the user interface
by Ian Horrocks"), but I'm still unsure whether this is the way to a good
solution (good = manageable and easily extendible with minimal risk for
Any advice or any hints on or any pointers to approaches or technologies
that might be suitable for this type of problems are most welcome.
Thanks in advance,