🤖▶️ Check out the Design Patterns Overview course by Steve @ardalis Smith!Check it out »Hide

DevIQ

Once and Only Once

Once and Only Once

The Once and Only Once principle can be thought of as a subset of the Don't Repeat Yourself principle, and is one of the most fundamental principles of software development.  Once and Only Once basically states that any given behavior within an application is defined Once and Only Once.  Duplication of behavior is one of the most common sources of bugs in software systems, since it becomes increasingly likely that changes to behavior defined in one location may not be propagated to all locations where this behavior is defined.  Eliminating the duplication caused by not following the Once and Only Once principle is one of the primary reasons for refactoring and is also at the core of many design patterns.

See Also

Don't Repeat Yourself

References

OnceAndOnlyOnce on the C2 Wiki

Principles of Object Oriented Design course from Pluralsight

Design Patterns Library from Pluralsight

Edit this page on GitHub

On this page

Sponsored by NimblePros
Sponsored