Monday, September 13, 2010

ch2 meaningful names

p48

Introduction
Names are everywhere in software.

(p 49)
Use Intention-Revealing Names

It is easy to say that names should reveal intent

The name of a variable, function, or class, should answer all the big questions.

bad code:
public List getThem() {
List list1 = new ArrayList();
for (int[] x : theList)
if (x[0] == 4)
list1.add(x);
return list1;
}

good code:
public List getFlaggedCells() {
List flaggedCells = new ArrayList();
for (int[] cell : gameBoard)
if (cell[STATUS_VALUE] == FLAGGED)
flaggedCells.add(cell);
return flaggedCells;
}

even better code:
public List getFlaggedCells() {
List flaggedCells = new ArrayList();
for (Cell cell : gameBoard)
if (cell.isFlagged())
flaggedCells.add(cell);
return flaggedCells;
}

Avoid Disinformation
(p50)
Programmers must avoid leaving false clues that obscure the meaning of code.
(p51)

Tuesday, August 10, 2010

ch1 clean code

(page 33)
There Will Be Code
(page 35)
The Total Cost of Owning a Mess
(page 36)
The Grand Redesign in the Sky
The Primal Conundrum
The Art of Clean Code?
(page 38)
What Is Clean Code?
(page 42)
(page 43)
(page 44)
We Are Authors
(page 45)
The Boy Scout Rule

The Boy Scouts of America have a simple rule that we can apply to our profession.
Leave the campground cleaner than you found it.

(page 46)
Prequel and Principles

"Agile Software Development: Principles, Patterns, and Practices (PPP)"

Conclusion
Books on art don’t promise to make you an artist.

Introduction