I've started to learn a little ROR and everthing I read says that ROR espouses the DRY principle and they seem to imply that this is a big thing that makes ROR different from other languages/frameworks.
What language does encourage duplicate code?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityI've started to learn a little ROR and everthing I read says that ROR espouses the DRY principle and they seem to imply that this is a big thing that makes ROR different from other languages/frameworks.
What language does encourage duplicate code?
It's not that other languages encourage duplicate code, per se, but the DRY principle of Rails people is pretty extreme in that anything that might be considered repetition is programmed away using the metaprogramming features of Ruby.
For example, in many web frameworks, the database schema and the object definitions have the same fields but have to be maintained separately. In C and C++, functions often have to be declared twice—once in a header file and once in the code itself. All of this kind of repetition is strongly deprecated in the RoR ethos.
In the case of modern languages, it's the designs, and moreover, the architectures, that encourage or discourage DRY. Keep in mind that some architectures favor one over the the other. Example: in MVVM, SRP > DRY in most cases. In MVVM you may find several classes and/or data structures that could be considered repetitious, but the main goal is to keep each class beholden to one master rather than to keep one class from repeating the code in another class.