Metadata in Your Applications

Throughout this chapter, we have discussed the use of metadata within managed applications as well as the flexibility provided by the .NET Framework for storing and retrieving metadata from application-specific configuration files. As demonstrated, there are a number of options for how an application developer might choose to leverage metadata within his or her application. In addition to the more tactical options for how best to incorporate and use metadata within your applications, there is a set of design principles enumerated below that should be applied when considering how best to incorporate metadata within your application.

Store application configurations in metadata

Configuration settings are critical to software applications and are very likely to change frequently. Storing configuration settings or any item that resembles configuration data within metadata allows applications to be highly configurable and adaptable to change. Whether storing user preferences, database connection settings, or the enabled/disabled state of a feature, storing metadata in an application’s configuration file is incredibly powerful. This practice promotes application extensibility and customization without actually recompiling or redeploying the software.

Store application details in metadata

Software applications contain a lot of details, such as user interface definitions like menu contents, default feature configurations, and other generally descriptive elements of the software. By storing this type of information within the code, the flexibility and maintainability of the application user experience is severely limited. As a rule, user interface definitions similar to the previous examples should be decoupled from the code and stored in metadata. Simple strings should be stored in .RESX files to enable localization, and other user interface metadata should be managed within the application’s configuration file or files. Following this guideline will help improve the flexibility and maintainability of the application over time, because user interface changes will be possible without redeploying the application.

Drive application behavior with metadata

Beyond storing metadata for simple preferences and user experience definitions, application developers should endeavor to drive application behavior through the use of metadata. This general principle promotes construction of more generic and reusable algorithms, which rely on metadata at run time to govern their behavior. By promoting code reuse, application developers inherently reduce the risk of introducing bugs into the software as new features are added. Additionally, by creating generic algorithms and abstracting the run-time instructions into metadata, the adaptability of the overall application is increased.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.139.15