7 of 59 menu

The DRY programming principle

The DRY (Don’t repeat yourself) programming principle involves breaking down a large system, such as software you’ve developed, into smaller, non-repeating components. If you have multiple components that perform the same tasks, the DRY principle requires that you reduce their number, ideally so that each component is unique.

Once a system has been divided into components responsible for performing well-defined tasks, they can be organized into classes, which is called a modular architecture.

To correctly build a system according to the DRY principle, it is necessary to adhere to the following rules:

  • Before you begin working on a project, visualize it as a diagram divided into visual components.
  • When working on a complex component of a project, it should also be represented graphically in the form of a UML diagram or similar means.
  • The graphical diagram should clearly indicate the hierarchy and role of each component of the project.
  • The diagram should also indicate the relationship of your components with components of other project participants, as well as which branches of the project will be public or private.
  • It is necessary to avoid rigid connections between components, as they negatively affect the efficiency of the entire project architecture.

See also

  • principle SOLID,
    which sets guidelines for OOP-based software
  • principle KISS,
    which involves abandoning the complication of software
  • principle YAGNI,
    which involves the rejection of redundant software functionality
  • principle CQS,
    which specifies only one command for each function
  • principle LoD,
    which is used in software development
  • responsibility separation principle,
    which is used in software development
plfrdehiuzl