Dynamic Constants

In applications that cannot be recompiled (e.g., apps that are installed on a customer’s machine as binaries only), values of constants may change occasionally. For example, exchange rates and the local sales tax rate are constants whose values are subjected to change. Using compile time constants for such values may cause maintenance problems. Consider:

 const double SALES_TAX =5.0; // not recommended.

Imagine what would happen if the local sales tax was raised or lowered. The user wouldn’t be able to modify the code and recompile the application. A better solution is to use a dynamic constant. A dynamic constant is a variable whose value is read from an external source, say a database table, an environment variable, a file, or a Web page at program’s startup. This value remains fixed until the application exits. Once the application executes again, it will read the updated values of these dynamic constants.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin


The Latest

technology leadership

Why the World Needs More Technology Leadership

As a fact, technology has touched every single aspect of our lives. And there are some technology giants in today’s world which have been frequently opined to have a strong influence on recent overall technological influence. Moreover, those tech giants have popular technology leaders leading the companies toward achieving greatness.

iOS app development

The Future of iOS App Development: Trends to Watch

When it launched in 2008, the Apple App Store only had 500 apps available. By the first quarter of 2022, the store had about 2.18 million iOS-exclusive apps. Average monthly app releases for the platform reached 34,000 in the first half of 2022, indicating rapid growth in iOS app development.

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job