Keep it simple, stupid (KISS) • Beware of optimization! • Favor Composition over Inheritance (FCoI) • Practices • Boy Scout Rule • Root Cause Analysis • Use a source code management system • Apply simple refactoring patterns • Reflect daily Donnerstag, 18. Juli 13
the need of maintenance • More code = more complexity • Reuse where possible double rate1 = calculateRate(1, 12); double rate2 = calculateRate(2, 24); double rate3 = calculateRate(3, 36); double rate4 = calculateRate(10, 120); Donnerstag, 18. Juli 13
keep your code simple • A genius is result = not(xor(bithackA, bithackB)) and not a = !A ^ B; • More code is sometimes better to understand • Don‘t let your method names lie public String toString() { if (im == 0) return Double.toString(re); if (re == 0) return im + " I"; if (im < 0) return re + " - " + (-im) + " I"; return re + " + " + im + " I"; } Donnerstag, 18. Juli 13
lot evil • Don‘t try to optimize for 2% performance, to get 5ms one-time performance • Improving performance by 500% to reduce runtime by days or weeks is something different Donnerstag, 18. Juli 13
entered it • Clean up the code around your changes • Small cleanups – huge effect • Rotten code starts also small – if no one cares • But you care! Donnerstag, 18. Juli 13