DELAPARRA
Index
Color
NL
Category: Programming paradigms

Code Generation

Explained by Updated

What is Code Generation?

Code Generation: Producing source or bytecode programmatically, e.g. an ORM generating SQL-mapping classes from a database schema. Code generation means writing programs that write code. Instead of typing repetitive classes by hand, a tool creates them from a schema, a template or a specification. You use it more often than you might think. php artisan make:model generates a model file. OpenAPI generators create API clients from a specification. GraphQL and gRPC tools generate typed classes from schema files.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Code Generation

What should you keep in mind with Code Generation?

It saves time and keeps similar code consistent. The rule is to be clear about which files are generated and which are written by people. Never hand-edit a generated file that will be regenerated, because your changes will be overwritten. Either commit generated files and regenerate them in a defined step, or generate them during the build and keep them out of version control.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with C

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.