This mornig I had to think a little about how to configure a particular system. Some parts of the system use different implementations of specific modules defined by interfaces. If there should be used a special implementation among the standard one, it is configured in a properties file. The value is the full qualified name of the implementing class, which is loaded and instanciated via reflection. Because we use Java and Java is a statically typed language, we have to cast the instance from Object to the interface.
This is a common pattern, I think. It is used by log4j for example.
Because we use a property configuration, which is not typed and validated against anything, the implementations can be configured as needed.
The opposite may be an XML configuration, which is validated against a schema. If we would use this and wanted to use it continuous for all modules, we had to design an universal schema for all modules or one for every implementation, which is imported into the main configuration.
It is very clear which one is faster and improves development speed. I have seen this pattern with dynamic configurations (even with an xml like syntax) several times in different Java applications and frameworks, but I just remember one with a statically typed, xml based configuration. But even this one used a universal, not really typed schema for the dynamic modules. So I think it’s just the same.
Applications, developed in a statically typed language, but dynamically typed. As I think about it, a common error in those applications are wrong configurations, mostly these little typos you do not find very fast and drive you crazy. Much like in dynamic languages. But would a strong and statically typed configuration, validated against some genius schemas, be worth the effort?
Just a little a thought, that crossed my mind.