-
Refactoring: Consolidate Duplicate Conditional Fragments; in Java, Python and Ruby
I’m reading the book Refactoring and one of the refactorings it shows is called “Consolidate Duplicate Conditional Fragments” and it shows an example in Java: if (isSpecialDeal()) { total = price * 0.95; send(); } else { total = price * 0.98; send(); } is refactored into if (isSpecialDeal()) { total = price * 0.95;…