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:
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.”