I'm looking for something that might be described as a "Scaffold design pattern".
I'm in the process of resurrecting an old piece of working but very buggy code that implements a Finite State Automaton in Java - you provide it with a model defined in XML and then you can throw events at it and query the resulting state or have it call back. It's far more complex than meets the eye because of composite states, complex synchbar and decision graphs, etc., etc.
The model is built in several stages: load the vertices from the XML source, link the vertices with transitions, check the model for consistency generating helpful errors and warnings. Then the model can be exercised in runtime.
Currently build-time and runtime code is found in the same class, e.g. CompositeState.java which seemed like a good idea at the time until the file size starting growing like topsy.
Is there a pattern I can use so I can build a complex object and then rip away all the build-time code like scaffolding to reveal a pristine, lean, runtime object?
The idea I have in my head is something like slicing the top off a class or something like that.