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 6732945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:42:38+00:00 2026-05-26T10:42:38+00:00

This is a high-level question and I am sure there is no universally correct

  • 0

This is a high-level question and I am sure there is no universally correct answer but I really would like to learn more about the different ways of doing this:

How does one best deal with parameters in a program?

To clarify, I am talking about all the values (e.g., of class variables) that the program requires to execute certain tasks. In many cases, one would like to use different values in different scenarios. So how to best deal with these (user-supplied) value?

Some approaches:

  • Simply define them in the code and change them as required (i.e.,
    change source code)
  • Use a special class to specify all parameters and use static imports
  • Implement an interface with all the parameters specified (and implement interface accordingly)
  • Pass them as command line arguments
  • Use a (text) file and load them (using, e.g., a class to access the values after loading)

I know that some of these are bad practice so please also list the pros and cons based on your experience.

  • 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-26T10:42:39+00:00Added an answer on May 26, 2026 at 10:42 am
    • I would put in the sources only real constants that are never changed. Having to rebuild a program because of a new input is not really necessary

    • The other option is to make them available with options or arguments (command line or GUI)

      • If your use case requires different arguments almost every time you use your program choose the command line option (with optional defaults). This will force the user to think about them

      • If the parameters rarely change use an option storage (text file, xml file, database whatever is best suited)

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

Sidebar

Related Questions

I don't have much experience in this yet but the high level question that
There was a question similar to this one, but w/o the answer targeted at
This is probably a pretty high-level question that requires a lot of explaining, but
This is more of a high level how do you solve this type of
Was asked this question recently and did not know the answer. From a high
Not getting into too many specifics, this is a high level question. I've always
This is a generic question that applies to (probably) any high-level programming language. Here
Following this question: Handling exceptions in a Swing UI (low level to high level
This is a high-level project organization question. What is the proper way to organize
This is a high level/design type question rather than anything specific. In this game

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.