
Code Generation Isa Design Smell [C2Wiki] - ak39
https://wiki.c2.com/?CodeGenerationIsaDesignSmell
======
Someone
I think the problem isn’t code generation, it is having to edit the generated
code.

So, you write source S from which you generate T, which you edit into U.

When you have to change S to S’, which generates T’, you have to do a merge to
get U’.

For example, the C preprocessor is fine, as long as you don’t start editing
its output.

Similarly, Java annotations that generate code are fine in this respect.

~~~
ak39
Agreed. Isn’t that what most of the framework based IDEs do for you? Look at
.net Web mvc or rest api application for example - code generated from wizard
after wizard. And then the developer massages the rest.

------
fjfaase
It mentions yacc/lex as bad idea, because they generate code that needs to be
compiled again. It is perfectly possible to implement an interpreting parser,
which parses some input from a grammar that is specified in some means. (If
you have the grammar of the grammar, you could even use it to parse the
grammar.) An example of this can be found at:
[https://github.com/FransFaase/IParse](https://github.com/FransFaase/IParse)

