I'm reading Martin Fowler's Refactoring book. In many of his refactoring examples, he is using variables that start with _varname
. Why? Is this some old convention that is before my time? In the past year when I started learning Java, I have not seen anyone at work use this. Please advise as to where and why should this be used?
I'm already seeing differences in answers to this question... Why does martin fowler do this in this code for extract method refactoring?
FROM:
void printOwing(double amount) {
printBanner();
//print details
System.out.println ("name:" + _name);
System.out.println ("amount" + amount);
}
TO:
void printOwing(double amount) {
printBanner();
printDetails(amount);
}