HACKER Q&A
📣 mbrizic

How often do you use code generators in your software projects?


I'm asking this as it seems like a really common pattern in projects that I worked on.

It usually goes like this: system architecture gets complex and elaborate enough that new features/modules require developers to manually copy and paste 5-10 files from the similar feature as a starting point. Most of that code is not even related to task you're trying to solve, just a general boilerplate to fit into existing architecture.

So a custom code generator gets written to ease those efforts.

To me it seems like inevitably every bigger project comes to this phase and we end up writing a generator for it. In fact, I'm working on one right now.

Wondering what are the other people's experiences with this.


  👤 ffwacom Accepted Answer ✓
Yes, it’s the only way to manage complexity. Been using Clojure and CL, basically everything is done with embedded macro DSL’s.

👤 pfdietz
I use Common Lisp, and macros there are code generators. So, every day?

Your experience seems to be an example of Greenspunning.