Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6346217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:58:34+00:00 2026-05-24T20:58:34+00:00

Say I have some program-wide information, like the root directory of the program or

  • 0

Say I have some program-wide information, like the root directory of the program or the language selected, that I would like the user to be able to change. How should I best go about storing this information in a form easily accessible at any time for any part of the program?

I was thinking of using global variables stored inside an individual file that could be included by other files that need the information. This way, I would just need to change the value of that global variable and the whole program could access the new value as it did before. However, I am afraid that using such global variables would be bad practice. What are your thoughts on this?

(Also, I thought that this would be language-agnostic, but if there are different best ways of accomplishing this in different languages, I would like to hear about that as well)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T20:58:35+00:00Added an answer on May 24, 2026 at 8:58 pm

    Sounds like a preferences API. Virtually every nontrivial application framework offers one these days, or even several. There’s one as part of the core Java API, for example, and another as part of the Eclipse framework. Windows has the registry, which you can use from any language on that platform, etc. These things are normally structured so there’s a static factory method you use to get ahold of the preference store for the application, and then you can interact with it from anywhere.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have some data allocated somewhere in my program, like: some_type a; and
Let's say I have a function that looks like this: public void saveBooking(/* some
Say I have some code like namespace Portal { public class Author { public
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
Let's say I have some code like this if(isset($_GET['foo'])) //do something if(isset($_GET['bar'])) //do something
Let's say I have some XML like this <channel> <item> <title>This is title 1</title>
Let's say I have some original text: here is some text that has a
We have a 3rd party program that appears to have some sort of an
Lets say you have some functions in some classes are called together like this
Say I have a user control like this: <UserControl x:Class=StyleTest.UserControl1 xmlns=http://schemas.microsoft.com/winfx/2006/xaml/presentation xmlns:x=http://schemas.microsoft.com/winfx/2006/xaml xmlns:mc=http://schemas.openxmlformats.org/markup-compatibility/2006 xmlns:d=http://schemas.microsoft.com/expression/blend/2008

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.