Things I learned after a decade of writing code generators
summary
After a decade of building generators the claim is clear: generators save boilerplate but introduce maintenance hazards. Practical wins include generate builders for Kubernetes by producing JSON Schema as an intermediate and supporting multiple languages; use specialized AST libraries (Jennifer style) instead of fragile templates; enforce semantic versioning and check generated code into VCS so changes are visible and downstreams can compile in CI. Watch out for nondeterministic LLM output—GitHub Copilot/Codium and LLMs need tool-chaining (LangChain) and guards, not blind unsupervised generation.
AI-written summary · about
chapters (14)
- 0:00Introduction
- 3:20Code generation importance
- 5:27First code generator
- 7:16Fluent builders for Kubernetes
- 9:27Polyglotism via code generation
- 10:53Domain specific languages and their challenges
- 14:09Template engines
- 17:25Specialized generators vs templates
- 21:20Handling incompatible changes
- 25:14Version control for generated code
- 29:26Tracking generated changes
- 32:16Generative AI limits
- 34:28Recap and key takeaways
- 35:31Q&A
related talks
51mGenerate You Some Code for Great Good
51mCode generation tips you didn't ask for
30mWrite Less (Code), Generate More
36mGenerating code in Go
51mCode generation tips you didn't ask for
42mBecoming the Metaprogrammer Real World Code Generation
52mCode that writes code - .NET Source generators
39mBuild without limits: lessons learned from using generative AI dev tool
