SW designer, 37y, married, 2 doughters. 12y graduated Twente, EE. 5y Philips CE and semi. 7y Sioux, worked for Philips HC, FEI and ASML.Write code in C, C++, C#, bit of Java and Python, and modelling in ASD.Are you programmers ? Ever heard of clean code ? Know the book ?
500 billion: Bron: http://www-03.ibm.com/software/products/us/en/category/SW730http://en.wikipedia.org/wiki/Software_qualityStudies: http://www.computer.org/csdl/trans/ts/2010/04/tts2010040546-abs.htmlCode that’s difficult to read tends to be difficult to test, too, which leads to fewer tests being written.
A software program will have, on average, 10 generations of maintenance programmers in its lifetime.Communication : So to minimize the cost of maintenance, your code should be clear to those people (or yourself) reading it a later date. It should be nice to read, it should clearly communicate its design, and it should not be overly complex.
From the book Clean code by Robert Martin.
By Kent Beck
Clean code – A Handbook of Agile Software Craftsmanship – Robert MartinStyle -> indenting
SOLID: SRP, OCP, LSP, DIP, ISP
Comments were considered good programming practice
Comments chapter from Clean code bookDon’t use comments to describe code. . Only use comments when the code can not tell it.
Func 150-500 -> 5-20File 1000-5000 -> 100-500Use extract method to make it smaller
For loop can have a inti as variable, when the scope is smallEncodings: it should read well (don’t abbriviate). Also don’t use hungarian notation etc. (http://en.wikipedia.org/wiki/Hungarian_notation)
Two/three: ordering of arguments is a problem. => mix upassertEquals(expected, actual);Flag: the call is confusing ! => split it up
Duplication is a problem for maintenance. You have to remember to change it in multiple locationsBeck (XP)Also Ron Jeffries says it is the second most important rule, just after getting the tests to passSwitch/case can be solved with polymorphismsDuplication is one of the big code smells that prgrammers have to solve
Easy: 3 lines of identical code=> Create new method
Higher level of abstraction: new method name describing what it doesTotal is 1 line less code
Every time you have an opportunity to change code, make sure it is a little cleaner.Boy scout rule: leave the campground a little cleaner than when you found it.
Motivator by John F Woods in 1991 (on the subject of using the comma operator)