...
Then we're talking about taking a (in OMG terms) a PSM, generating an artifact into the real world then reverse engineering the artifact into a PSI (my invention - the Platform Specific Implementation.
...
Oh, it's basically a good idea to talk about it in OMG terms of Model Driven Architecture (MDA).
1. The term "problem domain" I described can be easily mapped to Business Model or Computation Independent Model (CIM)
2. The term "solution domain" is more complex and has to mapped to
a) Platform Independent Model (PIM) is a technology-neutral system specification that conforms to a business model
b) Platform Specific Model (PSM) is a technology specification that conforms to the PIM system specification
c) And finally - Platform Specific Implementation (PSI)
The "easiest" part of code generation is conversion between PSM and PSI. It can be more or less complex depends on technologies and the decision what is the master. In case the code is the master, means, the user is allowed to modify the code after generation and he/she is allowed to use every feature of the target programming language also, then even that "easy" part becomes very-very complex.
The next level is the conversion from PIM to PSI. It is only possible if you do it in two steps: first one - modeling PIM, next one enriching it by the platform specific part but keeping it separately, so the user can change PSM without touching PIM later on. You can also make platform specific part exchangeable / configurable. In both cases it is not a trivial job.
I believe it is possible, but there are a number of challenges to be solved.
So, we are working on that