Categories: Project Tips and Tricks

Tags: DRY, DRY Principle, High Quality, Programming, Programming Principle

DRY Programming Principle: Don’t Repeat Yourself / Do Not Repeat Yourself

The “DRY” principle of programming allows one to achieve high maintainability of a project, ease of making changes, and high-quality testing.

If the code is not duplicated, the project has greater simplicity. Changing the logic requires corrections to be made in just one place. It is easier to test one function, rather than dozens of the same type.

The DRY principle always leads to the decomposition of complex algorithms into simple functions. And the decomposition of complex operations into simpler (and reusable) ones greatly simplifies the understanding of the program code. Reuse of functions derived from complex algorithms reduces the time for developing and testing new functionality.

Benefits of the DRY Principle

The DRY principle leads to a modular application architecture and a clear division of responsibility for business logic between program classes. And this is the key to accompanied architecture.

Within a single program class (or module), following DRY and avoiding repetition is usually easy enough. It also does not require monumental efforts to do this within the framework of small projects, where all developers “own” all the code of the system.

In large projects, the situation with DRY is somewhat more complicated – repetitions most often appear due to the developers’ lack of a coherent picture or inconsistency of actions within the team. Following the DRY principle in large projects is not as easy as it might seem at first glance. Developers are required to carefully plan the architecture, and the architect or team leader is required to have a vision of the system as a whole and clearly set tasks for developers.

DRY Design

In the design of DRY, access to a specific functionality should be available in one place, unified and grouped according to some principle, and not “scattered” around the system in arbitrary variations. This approach intersects with the Single Responsibility Principle of the Five SOLID Principles articulated by Robert Martin.

Creating high-quality software is important to us at Swan Software Solutions. If you need the right technology partner for your project, schedule a free assessment today.

Leave a Reply

Your email address will not be published. Required fields are marked *