Metadata-Driven Applications
Metadata can be used for configuring and driving the applications. Our goal is to create highly dynamic and adaptable programs. For this, we adopt a general rule: program for the general case, and put the specifics somewhere else—outside the compiled code base.
Put Abstractions in Code Details in Metadata
The benefits of this approach are:
- Helps us to decouple our program, resulting in a flexible and adaptable program.
- Helps us to create a robust, abstract design by deferring details out of the program.
- We can customize our applications without recompiling it.
- Metadata can be expressed in a manner that's much closer to the problem domain than a general-purpose programming language might be.
- We can implement several different projects using the same application engine, but with different metadata.
The next important question is, when to configure? Most of the applications read the configuration only during start up. In this case, most of the times, we have to restart the application for applying the configuration. A more flexible approach is to write programs that can reload their configuration while they're running.
- summary of Metaprogramming, from The Pragmatic Programmer: From Journeyman to Master