The Startup
Published in

The Startup

Don’t Don’t Repeat Yourself


  • “Don’t repeat yourself” (DRY) is a widely accepted programming principle, but it has several limitations
  • An alternative derivation of DRY is presented, that aims to alleviate some of these limitations
  • Programs are made up of functions, and to make functions maximally reusable they should:
    - Have the most lenient preconditions
    - Have the most strict postconditions
    - Perform the smallest amount of non-trivial work

If you think this article is too long, you can skip to Should I refactor my code



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Andrew Pritchard

Andrew Pritchard

The stories I write are a part of a learning journey through life, logic and programming. Share this journey with me.