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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T12:03:48+00:00 2026-05-12T12:03:48+00:00

Consider a production planning application with many products. Each product has a list of

  • 0

Consider a production planning application with many products. Each product has a list of InventoryControl objects keyed on InventoryControlType. Depending on the algorithm we run for production planning, we need to access to different types of InventoryControl objects for a given product. This works OK. However, today I needed to introduce a field in InventoryControl that holds the InventoryControlType since deep in our algorithms we needed to know the InventoryControlType.

However, I felt felt like I was doing something wrong since it looks like I am repeating data.

Does this design look OK to you? Any ideas for improvement?

class Product{
    Dictionary<InventoryControlType, InventoryControl> InventoryControls;
    GetInventoryControl(InventoryControlType type){
        return InventoryControls[type];
    }
}

class InventoryControl{
    InventoryControlType controlType;
    float limit;
    float cost; 
    ...
    CalculateCost(){...}
    GetConstraint(){...}
}
  • 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-12T12:03:48+00:00Added an answer on May 12, 2026 at 12:03 pm

    I think you’re fine. It’s perfectly normal (at least in my experience) to use a unique property of an object as a key–be it in a Dictionary, a DataTable, or what have you.

    For example in my own work our major project features a class called Product with a property called Symbol, and the application maintains a Dictionary called Products with each Product object’s Symbol property serving as its key.

    Think of it this way: if you have a database with two tables, and one table references rows in the other by key, it may feel like you are “duplicating” data in the sense that you have the same number (the key) in two places. But that is not duplication; it’s a reference. The same applies in your scenario.

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

Sidebar

Related Questions

Consider this situation: There's a critical VB6 desktop application running on a production box.
When shipping a web application to production, would you consider an enterprise application archive
Consider an SVN repository which has a file with great production importance: . ├──
I consider running VisualVM against a production JVM to see what's going on there
Consider a basic Rails development pipeline, going from development -> staging -> production. When
There is a web application which is in production mode for 3 years or
I maintain an application that uses a (to me) surprising PHP quirk/bug/feature. Consider this
I have a Rails application that unfortunately after a request to a controller, has
Consider the following scenario (this is not production code): class MyClass { public function
We have a database in production that already has a good number of rows

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.