There is a bad practice in software engineering where a single piece of data is held by value in multiple places.

For example, in an FPS, the location of the player could be held by the AI class, the input class, the main class, and the graphics engine.

Multiple problems can arise from this:

  1. Synchronization issues
  2. Increased code complexity to lock the variables till all classes have been updated
  3. Increased code complexity to provide setters on all classes
  4. It becomes vastly more difficult if there are multiple inputs points to make sure that each input and output is updated each time any of the code changes

Obviously, best practice would be to have a single class which contained all information about the player and it would be referenced, not copped, by each other class.

I want to talk about this bad practice, and I'm pretty sure it has a name, but I can't seem to find anything. I've heard the terms "data duplication" and "data mirroring" used, but I'm not sure if those are correct. Can anyone call out this term?

  • Whilst this is generally bad practice, a common (valid) scenario is in the swapping of variables which typically employs a dummy variable. There are ways to get round this though.
    – Robbie Dee
    Apr 29, 2016 at 14:32
  • @RobbieDee Right, temporary, const copies of the data are often necessary for various library functions, that's why I gave the example. What I'm calling out is the use of multiple copies of a variable that are not temporary. Apr 29, 2016 at 14:44
  • 1
    The only reason I've ever been able to discern for people doing this is premature micro-optimization. Some programmers have the idea that calling getters is very expensive. Apr 30, 2016 at 1:12

2 Answers 2


The principle you're defending is that of a "Single Source Of Truth".

The corresponding antipattern doesn't have such a general name. Violating DRY ("don't repeat yourself") is sometimes called WET ("write everything twice"). In databases, violating normal form is called denormalization (and is sometimes good practice when trading off time versus space). But there is no fixed phrase like "Multiple sources of truth" that practitioners would immediately recognize as the name of an anti-pattern.


Single source of truth

In information systems design and theory single source of truth (SSOT), also known as single point of truth (SPOT) refers to the practice of structuring information models and associated schemata such that every data element is stored exactly once (e.g., in no more than a single row of a single table). Any possible linkages to this data element (possibly in other areas of the relational schema or even in distant federated databases) are by reference only.

Because all other locations of the data just refer back to the primary "source of truth" location, updates to the data element in the primary location propagate to the entire system without the possibility of a duplicate value somewhere being forgotten.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.