====== Centralized Configuration File Anti-Pattern ====== Centralized configurations are generally used to simpify the complexity resulting from interactions between various templates, modules, and components of a web application. ===== Are centralized configurations an Anti Pattern? ===== Many widely distributed PHP and Perl projects use a central configuration file to provide end users with a simple way of installing and customizing various aspects of the application simply by tweaking configuration variables. This approach can lead to strange issues with orthogonality - configuration variables are scattered throughout the different parts of the code, making it more difficult and confusing to maintain clear tiered layers, and separation of responsibility. Not an object oriented way of doing things. ===== Struts Mappings ===== Placing an entire site structure in a single XML file or array. Can lead to giant, unwieldy XML mappings. Useful for modularizing functionality, or enabling a "plugin" architecture. See [[java:Struts]] ===== Fusebox ===== Fusebox evolved as a methodology for Cold Fusion development, aiming to break down a web application into simple, manageable 'chunks'. In it's simplest form, the Fusebox is a switch statement that triggers hardcoded actions from a set of include files, based on a querystring 'fuse'. The full blown methodology is based around the concept of a 'Circuit' - representing a logical unit of functionality within a site. The Fusebox acts as the Circuit controller, directing requests to arbitrary '' FuseActions'' - a set of file includes that perform a single logical task. These files are organized using a prefix based naming convention: ''dsp_'' for display templates, ''qry_'' for SQL queries, ''app_'' for application logic, and ''act_'' for an action. Criticism of Fusebox highlights its inability to capture complex business rules and domain models with its linear switching structure. The way around this is usually to embed complex hacks and lower level includes within the display templates, leading to major problems with maintainability. Maintainability problems also arise from reliance on hardcoded switch statements, which promote tight coupling between various separate objects of the application. See [[http://www.corfield.org/index.php?fuseaction=fusebox.rewrite|Rewriting corfield.org using Fusebox]]. Perhaps due to it's simplicity to implement, Fusebox has reached a relative level of popularity in PHP: * http://bombusbee.com/ * http://php-fusebox.sourceforge.net/ * http://www.meta-magic.com/cgi-bin/fusewiki?Home