Today at the office I encountered another nightmare. It seems like the author of the code above was doing the development late at night, he sleep in the middle and unintentionally pushed Ctrl-V button.
The next day most probably he woke up late and had to continue working on the project coming night. As he didn’t sleep well last night, he got too tired and slept over his keyboard. Yes, you’re already guessing – he pushed Ctrl-V button again.
Here are 2 types of code duplication. The first one exists in a function. The second is the duplication of code among different classes. What I’m suggesting is never do that. Otherwise a chunk of code will appear in my blog and become famous.