am 17. Juni 2000
The thirteen columns in this book appeared in the Communications of the ACM between 1983 and 1985. There can't be more than a couple of technical books on computing from that era that are still worth reading. Kernighan & Ritchie's book, "The C Programming Language", is one that springs to mind; this book is definitely another, and will probably outlast K&R as it has almost no ties to existing or past hardware or languages.
What Bentley does in each of these columns is take some part of the field of programming--something that every one of us will have run into at some point in our work--and dig underneath it to reveal the part of the problem that is permanent; that doesn't change from language to language. The first two parts cover problem definition, algorithms, data structures, program verification, and efficiency (performance, code tuning, space tuning); the third part applies the lessons to example pseudocode, looking at sorting, searching, heaps, and an example spellchecker.
Bentley writes clearly and enthusiastically, and the columns are a pleasure to read. But the reason so many people love this book is not for the style, it's for the substance--you can't read this book and not come away a better programmer. Inefficiency, clumsiness, inelegance and obscurity will offend you just a little more after you've read it.
It's hard to pick a favourite piece, but here's one nice example from the algorithm design column that shows how little the speed of your Pentium matters if you don't know what you're doing. Bentley presents a particular problem (the details don't matter) and multiple different ways to solve it, calculating the relationship between problem size and run time for each algorithm. He gives, among others, a cubic algorithm (run time equal to a constant, C, times the cube of the problem size, N--i.e. t ~ CN^3), and a linear algorithm with constant K (t ~ KN). He then implemented them both: the former in fine-tuned FORTRAN on a Cray-1 supercomputer; the latter in BASIC on a Radio Shack TRS-80. The constant factors were as different as they could be, but with increasing problem size the TRS-80 eventually has to catch up--and it does. He gives a table showing the results: for a problem size of 1000, the Cray takes three seconds to the TRS-80's 20 seconds; but for a problem size of 1,000,000, the TRS-80 takes five and a half hours, whereas the Cray would take 95 years.
The book is informative, entertaining, and will painlessly make you a better programmer. What more can you ask?
am 23. April 2009
Jon Bentley hat mit diesem Buch einen Klassiker geschaffen. Die Kapitel an sich sind bereits vorher in einem Journal der ACM erschienen, haben aber grössere Ueberarbeitungen erfahren. Auch wenn die Wahl der Programmiersprachen (Basic, COBOL, C) nicht mehr ganz aktuell ist, so erfährt man doch einige grundlegende Herangehensweisen, die zeitlos sind. Ein Beispiel dafür ist die Laufzeit eines Algorithmus abzuschätzen (O(...)-Notation), womit man die asymptotische Komplexität beschreibt. Dann zeigt er anhand einer Cray und eines anderen Computers, dass ein schlechter Algorithmus auf einem Supercomputer langsamer ist, als ein guter Algorithmus auf einem Homecomputer! Wer maximal von diesem Buch profitieren will, sollte unbedingt die Aufgaben lösen. Sehr empfehlenswert.
am 2. März 2000
Without any doubt, my favorite article in _Communications of the ACM_ in the 1980's was the regular 'Programming Pearls' articles by Jon Bentley. When the first edition of these collected gems was published, I read it with great delight. Now, over a decade later, a second edition has been published, containing the same problems with additional modifications and notations. Given the enormous changes in programming since the mid 80's, your first reaction might be that this book is dated and therefore irrelevant. Nothing could be further from the truth.
Elegant solutions to complex programming problems are free from the rot of time. Programming is a thought process largely independent of the notation used to write it down. The solutions are sketched and explained rather than coded, and the solutions are complete. There is a certain mystique about taking a complex problem, finding an initial solution and then refining it down until it kicks some big time. There are some major lessons in program refinement explained in these solutions.
Coding a binary search is covered quite extensively, which may seem like a waste of space, as this problem was solved decades ago. However, that solution took decades to get right, and this is one of those "separates the coders from the key bangers" type of problem. Other problems examined include performance tuning, squeezing space and program correctness. While the improvement in the performance of the hardware has been astounding since these solutions were written, that does not make them obsolete. The complexity of the programs that we now build has risen even faster, so performance and space considerations are just as critical.
Some problems were here at the beginning and will still be here at the end. Even though there may be canned code to handle them, these problems are generic enough that the solutions can be applied elsewhere, so we must learn how to solve them. Understanding these problems and their solutions will give you a fundamental skill set that will serve you well for a long time.
am 21. Dezember 1998
This book goes into what is overlooked and should be taught in "computer science" classes. Instead of focusing on conspiracy-driven "good programming practices" with trite and bloated algorithms, this book focuses on efficient, simple, and creative solutions to problems. This emphasizes on creating solutions that work well on COMPUTERS (albeit dated computers) and not abstract turing machines with no disk or memory limitations! Programming Pearls is easy to read, with lots of little excersizes to get your brain thinking for FUN and PROFIT. This book truly has SLACK.
am 18. Dezember 1999
It's great to see they've come out with an update to this book. The essays in this book are easy to read and touch on many valuable things, such as tuning and optimization of algorithms, using mini languages to provide robust tools, doing back-of-the-envelope calculations, and much more. I have recommended this book to several beginning programmers that I know as an excellent introduction to thinking effectively about the challenges of software engineering.
am 18. Juni 1998
This slender volume is one of the all-time classics for programmers. Each chapter is an essay from Bentley's wide-ranging programming column dealing with an algorithm, an engineering principle or some more general technique of reasoning. Beginners and experienced professionals alike will be delighted. This is one of the few books for serious programmers which can also be read with pleasure by the non-expert, even by the non-programmer. You'll find the techniques of thinking explained in this book popping up again and again whether you are coding or reading the newspaper. I have owned and loaned I don't know how many copies; nobody ever returns it.
am 18. April 1997
There are not many books on advanced computer programming that you actually want to read. Usually, the subject is so dry and full of theory that you have to force yourself. This book is the exception. Bentley's easy-to-read style makes this book a pleasure to read. His theoretical analysis is impeccable, but he presents complex topics in a chatty format that makes you remember the joy you felt the first time you wrote a program, and lets you know he still feels that way