Data Centers

The Magic Kingdom

Date Added: Jun 2009
Format: HTML

The magic values or literals of an application are expressed in code. These values can be fixed for the life span of an application or can also be change occasionally. The hard-coding of literals should be avoided while changing the old value to the new one. One of the important techniques for avoiding hard-coding is to refer to the magic value by name. A package can be created with a defined constant that can hold the value. This constant can also be added to an existing package. Constant keyword should be included in the statement of the magic value that does not change its value. A database table is created that is used to accumulate and control the magic values of an application. Mentioned here are the approaches that are designed to manage magic values in applications. The function approach discussed in the paper does not let the developers see the actual value as they build code that avoids quick programming. This approach does not change the specification of the value and also lets developers situate the function directly within an SQL statement. A PL/SQL constant cannot be used inside SQL unless it is executed from within a PL/SQL block. The other approach for managing magic values is package of constant that is the simplest and efficient means of delivering the magic value. This approach declares the package invalid on changing the value of constant.