Take the following snippet:
List<int> distances = new List<int>();
Was the redundancy intended by the language designers? If so, why?
Redundancy is when we use two or more words together that mean the same thing, for example, 'adequate enough'. We also say something is redundant when a modifier's meaning is contained in the word it modifies, for example, 'merge together'. When we write, we should try to be as clear and concise as we can be.
code which is executed but has no external effect (e.g., does not change the output produced by a program; known as dead code).
Plan to design and write modular code from the beginning of a project, and enforce DRY principle results. If the modules are small and reusable from the design phase, the resulting code is much likelier to be DRY. Code reviews also help reinforce the DRY principle and reduce code redundancy.
Redundancy in information theory is the number of bits used to transmit a message minus the number of bits of actual information in the message.
You could always say:
var distances = new List<int>();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With