Jos van Uden:

It's fine, but we need another write at the end of run otherwise the final state doesn't get written.

OK. Feel free to fix the code:
http://codepad.org/MvpSET1I

Writing good enough code is an iterative process... And this code will probably need few more iterations.


I'm thinking about putting the definitions in xml,

Please no :-) Especially in a such small program.


BTW, the reason I used a class is that it forces you to instantiate through the constructor.

If you use a class and write:

(new UTM().run()); // fails at compile time

If you use a struct and write:

UTM().run(); // fails at runtime

OK, feel free to change back the code to a final class. We'll try to find a better solution in successive iterations.

Bye,
bearophile

Reply via email to