Monday, March 7, 2011

Programming Pearls 2nd Edition by Jon Bentley

Rating: Devilishly difficult sometimes, but valuable. I will read it again one day.

Notes:
  • Principles from Column 1: 
    • ''The Right Problem''', 
    • The Bitmap Data Structure, 
    • Multiple-Pass Algorithms, 
    • A Time-Space Tradeoff and One That Isn't, 
    • A Simple Design, 
    • Stages of Program Design.
  • "don't write a big program when a small one will do" - page  29
  • "the more general program may be easier to solve"
  • "back of the envelope" calculations - page 67
  • Rule of 72
  • Little's Law: "The average number of things in the system is the product of the average rate at which things leave the system and the average time each one spends in the system." - page 73
  • save state to avoid re-computation - page 84
  • pre-process information into data structures, divide and conquer, scanning, cumulative
  • Good programmers keep efficiency in context: it is just one of many problems in software, but it is sometimes very important. - p.87

Criticism:
  • If we assume that we have a "reverse" function, why not assume that we have a rotate function, and be done with it? - Column 2
  • Variables in examples have almost always 1 letter names: m, n, i, x, l, t.


Bottom Line:

What makes this book difficult to read is the mathematical approach.

The problems are not common - almost nobody is writing their own search algorithms, or random number generators nowadays - but they provide insight into how things work. For example why it is a good idea to tell the hash class at initialization the approximate number of elements.

This book is a hard one. I feel like I need to read it again, do some exercises, and feed the Mnemosyne.

No comments:

Post a Comment