Is Your Code DRY or WET?

Don’t Repeat Yourself (DRY)
is a software development principle, the main aim of which is to reduce repetition of code.
Write Everything Twice (WET)
is a cheeky abbreviation to mean the opposite to DRY principle.
So each Software principle has Proc and Cons. Lets discuss about it more.
DRY
Advantages
- One Good thing is
Readability
, you can easily follow the code. Reusability
is also more important, because same code piece can be reused with little logic change.-
Cost
is more important nowadays, when growing code base, it takes time to test, deploy, storage capacity and so on. -
Maintainability
also more important, because change of logic in one place applies all over the places.
Disadvantages
- You may have to
think a lot
before implement the logic, because same functionality will be used in any other places. -
Over-dried code
may not easily understandable.
WET
Advantages
Separator
code for each functionality.
Disadvantages
- Low
Application efficiency
Which one is best?
In terms of deciding DRY or WET bit hard in first place, Personally I feel ugly, When look at the WET code. But if you follow good OOP – Inheritance, Polymorphous, encapsulation and good design patterns, that make you NOT to be WET too much and stay in DRY and shiny.
Right here is the right webpage for anybody who wants to understand this topic. You understand so much its almost tough to argue with you (not that I really will need to…HaHa). You certainly put a new spin on a topic that’s been discussed for ages. Wonderful stuff, just wonderful!
Yes, initially I had lots of confusion between these two, this article came up with my experinace and what I red from many Developers, just thought to summaries where that can be used by some one else in later.
In other way “if we write good code , maintains will be easier, because we are the who maintain after development”
Feel free to add anything. 🙂
Thanks