In my last article, ” Caught Up in Code, or Quick Configuration”, I proposed that you build more configuration based software solutions and less software that is governed by the relatively rigid rules of code alone. That article focused on the concept of configuration-based development. In this article the focus is on using the patterns for implementing a configuration-based solution.
A Few Examples
Before we drop into the details of a code sample, here are a few quick examples of how you can apply the configuration based pattern in the code you’re writing.:
- Factory Pattern – Using reflection, generics, interfaces, and a configuration file, you can create a strongly typed factory that can generate objects of any type. You wouldn’t have to worry about ever building another factory class.
- Optional Display – User Interface trimming, in other words, removing items from a menu when the user doesn’t have access to them is a time consuming process. However, a control can be built uses a list to determine the menu options and performs the security check as a part of drawing the menu. You wouldn’t have to worry about trimming my UI because the control manages security automatically.