views:

135

answers:

2

Something a lot of programmers seem to be abiding by is Convention of Configuration. In the context of IoC this means using the API instead of XML configuration.

How are you supposed to keep the loose coupling idea behind DI/IoC when you have to reference the DLL containing the concrete implementations of the abstract interfaces/classes to use convention of configuration?

A: 

It means you have to balance them; don't get trapped by either/or thinking.

On the other hand, if you do need configuration files, don't be trapped into thinking they must be XML. XML is a relatively heavyweight representation; JSON, YAML etc is widely available and easier to use for most configuration file sorts of storage.

Charlie Martin
+2  A: 

Configuring via a code API is not "convention." It is "configuration."

Convention over configuration means, for example, that a particular application framework (such as Rails or CodeIgniter) may require that certain types of code be placed in certain directories. You are not required to tell the application framework where these files are via configuration.

Justice