Saturday, July 26, 2008

Just Say No to Deflaut Configuration

What I'm talking about is when an application sets its configurable properties using default values because the configuration for the environment the application is intended to run in cannot be set. Default configuration can be the result of specific application logic or a feature of the configuration framework or mechanism used. How this usually plays out is that some generic set of values, often the ones used in the "dev" environment, are used instead of the values for a specific environment like "qa", "stage", or "prod". Sometimes a debug or info message or, if you are lucky, a warning message will be logged. But just as often there is no direct evidence that the desired configuration has not been used.

At first blush having a default configuration to fall back on seems like a good idea. It can simplify development, especially unit testing, because things just work. There is no need to understand or be bothered with the details about configuration before you've even started coding. Where this will come back to bite you, and I guarantee that sooner or later it will, is when someone forgets to configure your application before a new production deployment. Everything looks great, the smoke tests pass, and everyone is happy. At least they are happy until, for some unknown reason, the pricing for widget XYZ is wrong or the customer ABC just seems to have disappeared. Since you turned off info and debug logging in production, there is nothing in your logs to indicate a problem. Now you get to spend some time frantically looking through code for the change, that doesn't exist, that is causing the problems.

Using default configuration violates the principle of failing fast. When there is a problem in your application, the application code should fail as soon as possible and it should be crystal clear why it failed. You don't want to detect a problem through side effects. When there is a serious error, and what could be more serious than incorrect configuration, I want to see a big red flag waving or at least a big loud error message in the logs! I want my application to fail before it can startup and cause even greater problems by reading or writing the wrong database or processing messages from the wrong message queue.

4 comments:

Chevy HHR Turbo said...

ur blog is really nice and interesting, You have maintain it so beautifully that I truly like & enjoy it

Nick said...

Thanks for post such as very useful and very lovely post.....

Software Product Development Services: - Ampere offers full cycle custom software programming services, from product idea, offshore software development to outsourcing support and enhancement.

Joshua Smith said...

I'm glad to know more and read this great review. I'm happy to share with cheap insurance that is supported by major insurers. Customer could save on cheap life insurance rates which allow you to obtain cheap affordable policy.

Anonymous said...

hemos adjuntado un tracback textos infantiles para niños hacia estos articulos
hemos adjuntado un tracback juegos a la moda para vestir niñas hacia estos articulos
hemos adjuntado un tracback textos cortos infantiles hacia estos articulos
hemos adjuntado un tracback cine hindú hacia estos articulos
hemos adjuntado un tracback miniseries gratis por internet hacia estos articulos
hemos adjuntado un tracback miniseries gratis por internet hacia estos articulos
hemos adjuntado un tracback reseta fácil con pollo y verduras hacia estos articulos
hemos adjuntado un tracback magia y esoterismo en el voodoo hacia estos articulos
hemos adjuntado un tracback transmisión colombiana de television hacia estos articulos
hemos adjuntado un tracback fraces celebres de famosos hacia estos articulos
hemos adjuntado un tracback www.unpuntomusical.com hacia estos articulos
hemos adjuntado un tracback solicitud de créditos hacia estos articulos
hemos adjuntado un tracback www.descargarwechat.org hacia estos articulos
hemos adjuntado un tracback www.linedescargar.com hacia estos articulos
hemos adjuntado un tracback www.mildietasparaadelgazar.com hacia estos articulos
hemos adjuntado un tracback cuentosdeterror.mx hacia estos articulos
hemos adjuntado un tracback cuentosdeterror.mx hacia estos articulos