Blog List

DRY Principle

Keep your project DRY

Today I am reporting on another proven principle from my projects, the DRY (Don't Repeat Yourself) principle. Most developers are, or should be, already familiar with this principle.
In my experience, however, applying the principle in a project can bring you real benefits and greater efficiency.

The DRY principle is mostly associated with software development. The principle was originally mentioned in the book "The Pragmatic Programmer". The duplication of the same lines of code should be avoided, as this later leads to higher maintenance costs and a higher probability of errors. However, the DRY principle can also make work considerably easier in many other areas.

Basically, you should avoid redundancy in your work as much as possible. In general terms, information should only be in one place. 

As a very simple example, we can consider specifying a version number in a software project. Instead of using them N times in the code, in the documentation, or in configuration files, it should be saved as centrally as possible with the project files, e.g. in a central file, or still better, via the version management system. In all other places where the version number has to be specified, it is either included automatically or only referenced.

Certainly, this is only a very simple example, but I often experience in projects that information is distributed across different files and has to be adjusted manually during a release. A manual process is always prone to errors, is often ineffective and frequently leads to inconsistent documentation and software versions.

In projects, it is always important to keep all documents in a consistent state. That is why, in cooperation with the customer, I have abolished the sending of documents via e-mail in some projects. The better solution here is to use a central and jointly accessible storage location, such as Google Drive or Microsoft OneDrive. For information to be passed on, only the links to the relevant files are then sent. This ensures that every reader or editor always has an up-to-date status.

Especially in large and complex projects, the DRY principle has proven itself. The effort involved in changing documents remains within the estimation and can therefore also be better planned.

Summary:

  • Do not create redundancy in your project. If possible, save information only once centrally.

  • Do not send copies of documents, but rather just pass on links to the respective documents.