3 ms·
> Code generation usually sucks. > A small one-off run under your control is an exception. But people learn to fear the thing, and apply that fear everywhere.
by vageli 7y ago
> Code generation usually sucks.
> A small one-off run under your control is an exception. But people learn to fear the thing, and apply that fear everywhere.
Why does it usually suck? Writing code that writes code seems like an optimization that would bolster productivity.
- karatinversion 7y agoMost of the code generation code I’ve seen is itself opaque and generates opaque code. This makes refactoring, extending and bug fixing hard.
- marcosdumay 7y ago> Why does it usually suck? One large factor is that when somebody really dislike the result of a code generator, they most commonly cope by editing the generated code by hand. With other metaprogramming techniques people can't do the same, so they fix the issues. The end result is that code generators are usually a set of mostly-functioning tools that create bad code that is almost, but not exactly impossible to understand but that you will be required to change at some point.