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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:15:57+00:00 2026-06-09T07:15:57+00:00

Is it preferable to store redundant information, (which can be otherwise generated from existing

  • 0

Is it preferable to store redundant information, (which can be otherwise generated from existing data,) or to instead convert the existing data each time you need access?

I’ve simplified my specific problem as best as I can below, hoping that the provided answers are useful as future-reference material.

Example:

Let’s say we’ve developed a program that places data into Squares on a grid (like a super-descriptive game of Tic-Tac-Toe or something) and assigns various details, and a unique identification number to each:

Also known as the world's easiest Sudoku puzzle.

Throughout our program, we often perform logic based on a square’s X and/or Y coordinates (checking for 3 in a row) and other times we only need the ID (perhaps to access a string at “SquareName[ID]”) – We aren’t exactly certain which of these two is accessed more often, but it’s a rather close competition.

Up until now we’ve simply stored the ID inside the square class, and converted it with some simple formulas whenever just the X or Y are needed. Say we want to get coordinates for one square in particular:

int CurrentX = (this.Square.ID - 1) % 3) + 1;  // X coordinate, 1 through 3
int CurrentY = (this.Square.ID + 1) / 3;       // Y, 1 through 3

Since the squares don’t move around or change ID after setup, part of me believes it would be simpler just to store all 3 values inside the Square class, but my other part cringes at the redundancy since access to X and Y is already easy enough to calculate from the existing ID.

(Note, This program itself is not very memory or resource intensive, nor does the size of the grid get much larger, so it mostly comes down to which option is a better practice or rule of thumb.)

What would you do?

  • 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-06-09T07:16:01+00:00Added an answer on June 9, 2026 at 7:16 am

    As a rule of thumb, for a system where the data is read/write, store your basic data without redundancy.

    When performance or other considerations become a practical issue, then you should denormalize as necessary. (i.e. wait for it to be a problem, don’t pre-optimize overly much).

    Your goal should be the most maintainable code possible. That usually means writing the least code possible. Having extra code to maintain redundant copies of data points will make your code more brittle.

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

Sidebar

Related Questions

In which cases storing data as XML is preferable to RDBMS and why? Can
any web service i can use to store small amounts of data (thinking XML
I'm writing a small Python script which will periodically pull information from a 3rd
Which one is preferable or more clear? public int FrozenRegionWidth { get; set; }
Which is preferable way to allocate memory for a function that is frequently allocating
I was wondering, is the size() method that you can call on a existing
I am needing to store easily parsable data in a file as an alternative
How can I store delegates (named, anonymous, lambda) in a generic list? Basically I
Is it preferable to explicitly set enum's fields instead of just defining their names?
I need to temporarily store my macro's settings for each worksheet. I thought about

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.