I'm about to writing an app which will be making use of the state and command patterns. The States will act as a facade to the commands.
There are 7 states and about 50 Commands which not all the states can execute, any method for which the command cannot be executed will throw an execption, otherwise It will create the command, execute it and return the result.
Since there are such a lot of classes that are going to be so similar I'm thinking of writing some code to auto generate the code. I've got a matrix mapped out in Excel of which states allow which commands to be executed, and I was planning on outputting that to csv and useing that as the basis for the code generation.
My idea is to manually write the interfaces that the various classes implement and then use that as a template for the code generator.
Is this a good idea? Does anyone have any tips on the best way to go about doing this?
I'll be codeing in Java however I think the basic principles apply to code generation in any OO language.