DEV Community

Cover image for DRY — Don’t Repeat Yourself
Juliana Dias
Juliana Dias

Posted on

8 5

DRY — Don’t Repeat Yourself

Good morning, good afternoon, good evening, good night, what they are in common? Yeap, the word “Good”. The concept DRY consists in look this and “dry” your repetitions, after dry could be: Good, morning, afternoon, evening and night. Being thus the word would serve for all, without losing the logic.

Let’s see example in a code:

Trecho do código antes de aplicar o DRY

Trecho do código posterior a aplicação do DRY

The same logic but in fewer lines of code. That is one of the philosophies about Ruby on Rails best practices, Ruby (and Rails) is fantastic because of this and others practices, Ruby code is totally readable, simple and powerful. And Rails has MVC organization, Tests, Naming Convention making a clean code, also has Convention Over Configuration and others things. So that’s it, let’s study and code.

“Know, understand, modify and create.”

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs