What is
OnceAndOnlyOnce?
Discovered Statements:
OnceAndOnlyOnce is a profound concept, but difficult to apply. ...
OnceAndOnlyOnce is not a pattern.
OnceAndOnlyOnce is a principle. --
RalphJohnson
OnceAndOnlyOnce is not just a simple rule, but a (not the) core goal of all software design.
One of the main goals (if not the main goal) when
ReFactoring code. Each and every declaration of behavior should appear
OnceAndOnlyOnce.
OAOO is once and only once of human input. If a copy can be regenerated without a human then it does not violate OAOO. --
AlekseyPavlichenko
OnceAndOnlyOnce: In programming, this generally means that you isolate functionality to one place in code. --
LionKimbro
With
OnceAndOnlyOnce, you are encouraged to refactor to eliminate duplicated code and functionality. --
AndrewHunt
You're done coding new function when the tests run. You're done refactoring when the code is
OnceAndOnlyOnce. At that point, the software is done. --
RonJeffries
Each and every declaration of behavior should appear
OnceAndOnlyOnce.
The philosophy that information on how a piece of software operates - be it an algorithm, a set of constants, human-readable documentation, or something else - should exist in only one place.
OAOO is another part of Simple Design. It is a warning against the common practice of copy-and-paste programming in which developers copy large chunks of code and duplicate the functionality throughout the program. Although this quick-and-dirty technique can be useful for getting something to run, the resulting duplication makes programs very hard to evolve and maintain.
Some argued it's not a design pattern, but a paradigm.
Contains no duplication.
Collected:
DonaldNoyes 20071008
CategoryDefinition