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

  • SEARCH
  • Home
  • 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 6159939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:12:56+00:00 2026-05-23T21:12:56+00:00

I am coding a desktop project which will includes several classes, and will put

  • 0

I am coding a desktop project which will includes several classes, and will put many parameters in several database tables to make it easy to centralized maintenance after deployment. The problem is that these parameters might be used in these classes (it seems that this makes these classes has something been hard-coded and not generalized any more).

Should I try to avoid this happening? If so, how should I do it?

I come up with two possible solutions: 1) use function parameters to pass these parameters into the class when they are invoked (but there may be many parameters need to be passed in and several of them might have very non-generalized names. So this will still make the class not generalized). 2) use events to make all these parameters assigned only in the main Class. This will make all the class generalized and the main Class is the only place maintain all the parameters setup in the code. However, it is relatively hard to make this logic fulfilled in the code. Is this the right way to resolve this issue or is there any other better ways to resolve this issue?

Many thanks for your input in advance.

Wei

  • 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-23T21:12:57+00:00Added an answer on May 23, 2026 at 9:12 pm

    It is really hard to understand the exact problem without getting an illustrated example of some code, but I will generalize my response…
    What you have described is the same thing I experienced a while back and typically it is the net result of making a function do to many things…

    I am not sure if you are familiar with patterns / best practices but the single responsibility principle springs to mind straight away – WIKI Single Responsibility Principle

    Have a relook at the methods and functions you are calling and see if there is a way that you can reduce them in complexity to the minimum parameters possible. Obviously with the root methods you may require a number of parameters – typically I use dependency injection and interfaces so that the function parameters do not get to long.

    For example a method with the following…

    class ExampleClass
    {
        void MethodWithManyParameters(int a, int b, int c, int d, int e, int f, int g)
        {
        }
    }
    

    Could be refactored to look like the following…

    interface iExample
    {
        int a { get; set; };
        int b { get; set; };
        int c { get; set; };
        int d { get; set; };
        int e { get; set; };
        int f { get; set; };
        int g { get; set; }
    }
    
    class ExampleClass
    {
        void MethodWithManyParameters(iExample value)
        {
        }
    }
    

    Hopefully this gives you a few ideas, obviously not a complete solution without a specific case given…

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

Sidebar

Related Questions

I am coding a desktop application which shows contents from text file in a
During coding I frequently encounter this situation: I have several objects ( ConcreteType1 ,
I'm currently working on my project which consists of front and back-end written in
i am working on project in which we are creating a web service that
I have a project coming up that involves a desktop application (tournament scoring for
I have been coding against a Delphi EXE (win32 desktop app) to access twitter
I've been coding in J2SE and now I'm currently working on a project that
Coming from a desktop background I'm not sure exactly how to pass the exceptions
When coding web services, how do you structure your return values? How do you
In coding a traditional MVC application, what is the best practice for coding server-side

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.