This century I wrote many posts about Code Generation. It’s a topic interested me since the eighties: how to make programs that write programs. But it’s not only code generation: it’s code generation from a model. That’s the key point to emphasize. Now, I want to write about the basis of such pragmatic solution to some of the problems in software development. My main assertion:
Code Generation From Model is an exercise of Raise the Level of Abstraction
The history of programming is a history of “raising the level of abstraction”. Instead to manipulate switch in the front panel of the first computers, we write programs using a language that is an abstraction: we use “int a”, as an abstraction of a word in memory. We write “foo(bar)” as an abstraction of save state in a stack, and jump to a memory address: we don’t write BALR (Branch and Link Register) instructions in IBM mainframe assembly language. Every day we use code generation: from the general/specific domain language our compilers generate the machine code, the only code that counts for our computers.
In this new post series I want to explore and write about these ideas:
- We improve our ideas and skills, but the technology is in constant change
- Abstract Model vs. Technology Models
- Separate problem from solutions
- Distill and reuse the developer knowledge
- Code generation FROM A MODEL as an exercise of abstraction
- Then, code generation from a model has a beneficial side-effect: shed light on the separation of what is important, from what is a technicality
- Code generation can (and must) coexist with human coding
Many of these topics were mentioned in my AjGenesis posts, but it’s time to present them as a integrated whole. The title of this post series “Raise the Level of Abstraction” was born in a technical talk at one of my customers, years ago. It’s good to find the same phrase as a “leit motiv” for Code Generation 2011:
I remember an older phrase from the same site: “code generation for the pragmatic engineer”. Code generation from a model is not a silver bullet: is another bullet, you can use in the right context.
(Note: I found the images at top using Google Image search terms: “two apples”, “two oranges”, “two sheep” and….. “two person” … no Microsoft promotion intended)