Questions tagged [code-generation]
The code-generation tag has no summary.
66 questions
138
votes
27
answers
33k
views
Is source code generation an anti-pattern?
If something can be generated, then that thing is data, not code.
Given that, isn't this whole idea of source code generation a misunderstanding? That is, if there is a code generator for something, ...
1
vote
3
answers
413
views
Code generation for multi-platform, multi-language library
I need to design a code generator system that produces serialisation/deserialisation libraries for multiple languages running on multiple platforms.
Hard Constraints
I need this to capture a pre-...
1
vote
3
answers
621
views
Autogenerate DTO classes?
Yesterday I screwed up:
One of the classes of my C# contained a property, called "DeliverdQuantity" (yep, there's a spelling mistake indeed). When I saw that, I decided to correct that, ...
23
votes
8
answers
6k
views
Detect manual changes to an autogenerated C header [closed]
I have a C header that is generated from a CSV file and a Python script. The C header mainly contains a list of #define constants.
I want to be able to detect manual changes to this header during ...
112
votes
22
answers
134k
views
Automatic programming: write code that writes code [closed]
After reading the book The Pragmatic Programmer, one of the arguments I found most interesting was "write code that writes code".
I tried searching over the net for some more explanations or articles ...
0
votes
1
answer
110
views
Identify downsides: versioning auto-generated Terraform source code [closed]
HINT: the purpose of this question is to identify downsides for the scenario described. If something is a downside, then it should be quantifiable and it should clearly have a negative impact.
...
51
votes
5
answers
15k
views
Do I check generated code in to source control or not? [duplicate]
I'm developing a .Net application that uses google protocol buffers. Historically the application used the approach, advocated by the protobuf-net team, of decorating the classes with attributes ...
33
votes
6
answers
10k
views
Why do programs use call stacks, if nested function calls can be inlined?
Why not have the compiler take a program like this:
function a(b) { return b^2 };
function c(b) { return a(b) + 5 };
and convert it into a program like this:
function c(b) { return b^2 + 5 };
...
7
votes
2
answers
2k
views
How to generate java class files with framework boilerplate in a project?
The Java project I am working on currently has a complicated folder structure, and to add a new functionality, one needs to add many .java files in different places in order to let it work in our ...
0
votes
2
answers
520
views
How to keep OpenAPI specification up-to-date and compliant without using code generators?
In our company, there is no standard for how to document APIs. Missing API documentation slows down the development process.
Therefore, we want to introduce OpenAPI.
We want to use code generators to ...
1
vote
2
answers
529
views
C# Source Generator : which way to go for a simple GitHub Community Project
CONTEXT
My project is about implementing the "conventional method for house-energy-efficiency assessment" in France (120 pages). I want to provide a strict yet easy to use API to this method....
-3
votes
2
answers
409
views
How to use Github Copilot for business software evolution (if possible at all)?
Github Copilot got update yesterday (2023 St. Valentine) https://github.blog/2023-02-14-github-copilot-now-has-a-better-ai-model-and-new-capabilities/ but still no information for its use in the ...
22
votes
4
answers
71k
views
How do we go from assembly to machine code(code generation)
Is there an easy way to visualize the step between assembling code to machine code?
For example if you open about a binary file in notepad you see a textually formatted representation of machine code....
0
votes
1
answer
239
views
Using sed/awk to bulk generate static HTML pages off of a template
Hypothetically, consider a social photo platform - each pic gets its own url, this page contains the image, text about the image, buttons for the user to click, related pics, and some user-specific ...
8
votes
3
answers
2k
views
code generation - would C be a good compiler backend?
In this and this stack overflow questions, the answers state that C as a compiler backend is a bad idea.
But why?
C has many compilers that can heavily optimize it. Every platform has a compiler ...