Metaprogramming
In a book about refactoring, it may seem a bit strange to talk about metaprogramming. More than refactoring per se, in our opinion, talking about metaprogramming and tools that use it can be useful concerning clean code, and writing clean code means “preventing” the refactoring, which is indeed still relevant to our goal.
As we will see shortly, metaprogramming involves writing programs that work on programs. In our context, we will endorse the usage of frameworks written by others (the first virtue of a good software engineer: laziness) that help us write less code (told you!).
Writing less code (or rather, having it written by tools) is a good thing: it means less code to maintain, trivially, and it means that those portions of code are in charge of dedicated tools that will then write that code in the best possible way.
In this chapter, we’re going to cover the following main topics:
- What is metaprogramming?
- Exploring compile...