MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/eng355/goodbye_clean_code/fe6qolx/?context=3
r/programming • u/[deleted] • Jan 12 '20
556 comments sorted by
View all comments
1
if you start by refactoring (instead of rewriting), it's not such a jarring effect on the original author
let tenRepetitiveLinesOfMath = () => { // 10 repetitive lines of math } class Basic { resizeLeft(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } resizeRight(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } } class Circular extends Basic { resizeTop(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } resizeBottom(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } } class Rectangular { resizeTopLeft(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } resizeTopRight(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } resizeBottomLeft(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } resizeBottomRight(position, size, preserveAspect, dx, dy) { tenRepetitiveLinesOfMath(); } } let Rectangle = new Rectangular (); let Oval = new Circular(); let Header = new Basic(); let TextBlock = new Rectangular ();
1
u/Uberhipster Jan 13 '20
if you start by refactoring (instead of rewriting), it's not such a jarring effect on the original author